cincura.net
cincura.net

Reputation: 4150

Different app.configs for different projects in same folder

I have few *.csproj (new format) in one folder ("same" project, different builds - no it doesn't work with single one) and I need to have app.config file with bindingRedirect for some projects. Is there a way to have distinct app.config names per project like it was possible for i.e. packages.config with packages.<project name>.config?

The only, fairly lame, solution I can think of as a workaround is to have a pre-build and post-build task to put the file there and remove it and make sure two builds are running together.

Upvotes: 1

Views: 171

Answers (1)

stijn
stijn

Reputation: 35901

Looking at the build output you can see a target named _CopyAppConfigFile which takes care of copying the config file. Looking further in Microsoft.Common.CurrentVersion.targets it can be seen that by default msbuild uses app.config, and this can be overridden by declaring a property AppConfig. So if you want to incorporate the project name in that use

<PropertyGroup>
  <AppConfig>app.$(MSBuildProjectName).config</AppConfig>
</PropertyGroup>

Upvotes: 3

Related Questions