简体   繁体   English

在Visual Studio 2010中检测解决方案配置

[英]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.

相关问题 Visual Studio 2010解决方案中不可用的项目 - Project Unavailable in Visual Studio 2010 Solution 在Visual Studio 2010中创建Web解决方案安装程序 - To Create a web solution Setup in Visual Studio 2010 如何将数据库添加到 Visual Studio 2010 解决方案? - How to add a database to visual studio 2010 Solution? 带有Visual Studio 2005解决方案的Windows服务未随Visual Studio 2010打开 - Windows Service with Visual Studio 2005 solution not opening with Visual Studio 2010 Visual Studio 2010捏和拉伸检测 - Visual Studio 2010 pinch and stretch detect Visual Studio 2010 无法打开 Visual Studio 2012 修改的 2010 解决方案 - Visual Studio 2010 cannot open a 2010 solution that Visual Studio 2012 modified 是否有将Visual Studio 2010解决方案转换为2008的技巧,工具和脚本? - Is there a trick, tool, script to convert Visual Studio 2010 solution to 2008? 在1个解决方案中的多个项目之间共享资源。 Visual Studio 2010 - Share Resources Across Multiple Projects In 1 Solution. Visual Studio 2010 重命名Visual Studio 2010中C#解决方案中的SQL Server表 - Rename SQL Server Table in c# solution in Visual Studio 2010 在Visual Studio 2010的解决方案资源管理器中禁用添加引用 - Disabled Add Reference in Solution Explorer on Visual Studio 2010
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM