条件$(配置)在.csproj中用于解决方案配置。有没有办法为每个单独的项目配置做??? [英] Condition $(Configuration) in .csproj is for solution Configuration. Is there a way to do it for each individual project configuration???

查看:117
本文介绍了条件$(配置)在.csproj中用于解决方案配置。有没有办法为每个单独的项目配置做???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

条件$(配置).csproj 使用解决方案配置。


有没有办法为项目配置而不是解决方案?


例如。我期待类似









< ItemGroup 条件 = " '$(ProjectConfiguration)'
=='Windows'
" >




假设我在Configuration Manager中将项目配置定义为Windows。

解决方案

您好5Ting,


感谢您在此发帖。


您确定.csproj中的属性


(配置)是否用于解决方案配置?据我所知和测试,它应该针对每个单独的项目配置执行此操作。例如,


我创建了两个测试样本项目,配置 Windows
MAC:



然后我为这两个项目文件.csproj添加了一个测试目标来输出属性的值

(配置)。


要完成此任务,请卸载项目。然后在项目的最后,就在结束标记< / project>之前,plac e脚本以下:

< Target Name =" Test" AfterTargets = QUOT;构建与QUOT;> 
< Message Text =" Configuration的值:" />
< Message Text ="


Condition $(Configuration) in .csproj uses the solution Configuration.

Is there a way to do it for project configuration instead of solution???

eg. I am expecting something like

<ItemGroupCondition="'$(ProjectConfiguration)' == 'Windows' ">

assuming I define a project configuration as Windows in Configuration Manager.

解决方案

Hi 5Ting,

Thanks for posting here.

Are you sure the property


(Configuration) in .csproj is for solution Configuration? As far as I know and test, it should do it for each individual project configuration. For example,

I have created two test sample projects with configuration Windows and MAC:

Then I added a test target to those two project files .csproj to output the value of the property


(Configuration).

To accomplish this, unload your projects. Then at the very end of the project, just before the end-tag </project>, place below scripts:

  <Target Name="Test" AfterTargets="Build">
    <Message Text="The value of Configuration:" />
    <Message Text="


这篇关于条件$(配置)在.csproj中用于解决方案配置。有没有办法为每个单独的项目配置做???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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