简体   繁体   English

Visual Studio的配置

[英]Configurations of Visual Studio

MS Visual Studio 2012 default has two configuartions: Debug and Release. MS Visual Studio 2012默认具有两个配置:调试和发布。 I write plugins for AutoCAD and BricsCAD. 我为AutoCAD和BricsCAD编写插件。 This code is the same, but using different libraries referenced. 这段代码是相同的,但是使用了不同的库。

I need to add new configurations: DebugForAutoCAD and DebugForBricsCAD . 我需要添加新配置: DebugForAutoCADDebugForBricsCAD Each of this must to has own references , default namespace , assembly name , output path and start external program option. 每一个必须具有自己的引用默认名称空间程序集名称输出路径启动外部程序选项。

If I change the references, these changes are applied to all configurations. 如果我更改了引用,则这些更改将应用​​于所有配置。 I need that references were individual for each configuration. 我需要每个配置的引用都是独立的。 And other settings too. 还有其他设置。

Can I do it easy? 我可以轻松吗?

As far as I know there is no user interface support in VS for this, but you can manually edit the project files like this: 据我所知,VS中对此没有用户界面支持,但是您可以像这样手动编辑项目文件:

<ItemGroup Condition=" '$(Configuration)' == 'DebugForAutoCad' ">
  <Reference Include="somref"/>
  <Reference Include="somotherref />
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'DebugForAutoCad' ">
  <OutputPath>somePath<OutputPath/>
</PropertyGroup>

<ItemGroup Condition=" '$(Configuration)' == 'DebugForBricsCAD' ">
  <Reference Include="anohterRef"/>
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'DebugForBricsCAD' ">
  <OutputPath>someOtherPath<OutputPath/>
</PropertyGroup>

and so on. 等等。 If you have to do this for multiple projects, I highly suggest putting everything common in a seperate file and use it in each project file using Import . 如果必须对多个项目执行此操作,我强烈建议将所有常见的内容放入单独的文件中,并使用Import在每个项目文件中使用它。

I recommend creating separate projects for each AutoCAD and Bricscad target, then simply share source files among all projects. 我建议为每个AutoCAD和Bricscad目标创建单独的项目,然后在所有项目之间简单地共享源文件。 This way the projects each have their own references, and use the standard Release and Debug configurations that can be easily managed in the UI. 这样,每个项目都有自己的引用,并使用可以在UI中轻松管理的标准Release和Debug配置。 It's a bit dated, but I blogged in 2007 about this: http://otb.manusoft.com/2007/06/visual-studio-build-configuration-tip.htm 有点过时了,但是我在2007年写了一篇关于此的文章: http : //otb.manusoft.com/2007/06/visual-studio-build-configuration-tip.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM