[英]Detect solution configurations in Visual Studio 2010
In my C# code I can do the following in the AssemblyInfo.cs file: 在我的C#代码中,我可以在AssemblyInfo.cs文件中执行以下操作:
#if DEBUG
[assembly: AssemblyInformationalVersion("0.7.7 Debug")]
#else
[assembly: AssemblyInformationalVersion("0.7.7 Release")]
#endif
Then I can batch build and get both debug and release version built with the correct version identifier. 然后,我可以批处理构建,并使用正确的版本标识符获取调试和发布版本。 Is there anyway to use the #elif and detect different build configurations to do something like:
无论如何,是否可以使用#elif并检测不同的构建配置来执行以下操作:
#if OPTION1 //x86 build profile
[assembly: AssemblyInformationalVersion("0.7.7 X86")]
#elif OPTION2 //x64 build profile
[assembly: AssemblyInformationalVersion("0.7.7 X64")]
#elif OPTION3 //etc
[assembly: AssemblyInformationalVersion("0.7.7 OtherPlatform")]
#endif
This way I can build all my versions at once and be able to identify exe's even if they get re-named or moved around. 这样,我可以立即构建所有版本,即使它们被重命名或移动,也能够识别exe。
It should work, just go into Configuration Manager and add a new configuration (for Solution or for individual projects, depending on your needs). 它应该可以工作,只需进入Configuration Manager并添加一个新配置(根据您的需要,针对解决方案还是针对单个项目)。 Then in the Properties of each project, select the configuration you want at the top, and you can define
Conditional Compilation Symbols
like OPTION1 or whatever you want to call them. 然后,在每个项目的“属性”中,在顶部选择所需的配置,然后可以定义
Conditional Compilation Symbols
例如OPTION1或任何您想调用的Conditional Compilation Symbols
。 You can define more than one for a given project by separating them with semicolons. 您可以使用分号将给定的项目定义为多个。 Then select whatever build configuration you want for that Configuration (like x86, etc.) and you should be all set.
然后为该配置选择所需的任何构建配置(例如x86等),然后就已经准备就绪。 See also the MSDN page on this .
另请参见MSDN页面 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.