局部的.csproj文件 [英] Partial .csproj Files

查看:223
本文介绍了局部的.csproj文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能将拆分在多个文件.csproj的信息?有点像部分类特征的项目版本。

Is it possible to split the information in a .csproj across more than one file? A bit like a project version of the partial class feature.

推荐答案

你不能有多个主的csproj。但由于的csproj的下面连线正在使用的MSBuild做,你可以简单地具有的互相多个部分的csproj。该解决方案文件将看到最多的导出的的csproj。

You can not have more than one master csproj. But because the underneath wiring of the csproj is done using msbuild you can simply have multiple partial csproj that import each other. The solution file would see the most derived csproj.

project1.csproj

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    ....
</Project>



project2.csproj

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="project1.csproj" />
    ...
</Project>



project.csproj - 这是被称为主体工程。解决方案文件

project.csproj - this is the main project that is referred by the solution file.

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="project2.csproj" />
    ...
</Project>



底线是,使用的MSBuild 导入功能,你可以有局部的csproj文件其中,每一个将包含主项目(在我的例子project.csproj)将使用的定义。

Bottom line is that using msbuild Import feature you can have partial csproj files where each one would contain definitions that the main project (project.csproj in my example) would use.


Visual Studio将显示一个安全警告的项目当你打开你的改变的解决方案或项目文件对话框。选择选项的加载项目正常并按下确定。当再次打开该解决方案后,警告将不会被显示,因为配置的加载项目正常存储在文件。

Visual Studio will show a Security Warning for project dialog when you open your changed solution or project file. Choose the option Load Project Normally and press OK. When opening the solution again later the warning will not be shown because the configuration to Load Project Normally is stored in the suo file.

这篇关于局部的.csproj文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆