Andrey Bushman
Andrey Bushman

Reputation: 12486

Configurations of Visual Studio

MS Visual Studio 2012 default has two configuartions: Debug and Release. I write plugins for AutoCAD and BricsCAD. This code is the same, but using different libraries referenced.

I need to add new configurations: DebugForAutoCAD and DebugForBricsCAD. 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?

Upvotes: 1

Views: 146

Answers (2)

Owen Wengerd
Owen Wengerd

Reputation: 1628

I recommend creating separate projects for each AutoCAD and Bricscad target, then simply share source files among all projects. 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. It's a bit dated, but I blogged in 2007 about this: http://otb.manusoft.com/2007/06/visual-studio-build-configuration-tip.htm

Upvotes: 0

stijn
stijn

Reputation: 35901

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:

<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.

Upvotes: 1

Related Questions