适用于不同环境的App.Config

时间:2016-10-06 16:14:02

标签: c# .net msbuild

我在配置上没有多少工作。我有5个环境,env1,env2,env3,env4和PROD。我有一个 App.config 文件,还有App.Debug.config,App.ENV1.config,App.ENV2.config, App.ENV3.config,App.ENV4.config和App.Release.config。我的问题是每个环境而不是读取自己的env特定文件,读取App.Config。 这就是我对ENV1的看法。

<Target Name="ENV1" DependsOnTargets="">
<Exec Command="powershell -ExecutionPolicy Unrestricted -File .\UpdateWebConfig.ps1" />

<MSBuild Projects="$(ApplicationProjectFile)"
           Properties="Configuration=ENV1;DeployOnBuild=True;PublishProfile=devscenmgrapp1;VisualStudioVersion=11.0" />

<Message Text="Clean project:" />
<MSBuild Projects="$(WpfApplicationProjectFile)" Properties="Configuration=ENV1" Targets="Clean"/>
<MSBuild Projects="$(WpfApplicationProjectFile)" Properties="Configuration=ENV1;Install=false;BootstrapperEnabled=false;GenerateManifests=true" Targets="Publish"/>

<ItemGroup>
  <ProjLocation Include="..\Source\DocGen.UI.TemplateDesignerWPF" />
  <ProjLocationReleaseDir Include="%(ProjLocation.Identity)\bin\ENV1"/>
  <ProjPublishLocation Include="%(ProjLocationReleaseDir.Identity)\app.publish"/>
  <DeploymentFolder Include="\\devscenmgrapp1\c$\InetPub\wwwroot\DocGen\Wpf"/>
  <SetupFiles Include="%(ProjPublishLocation.Identity)\*.*"/>
  <UpdateFiles Include="%(ProjPublishLocation.Identity)\Application Files\**\*.*"/>
</ItemGroup>

<Copy SourceFiles="@(SetupFiles)" DestinationFolder="\\devscenmgrapp1\c$\InetPub\wwwroot\DocGen\Wpf\" />
<Copy SourceFiles="@(UpdateFiles)" DestinationFolder="\\devscenmgrapp1\c$\InetPub\wwwroot\DocGen\Wpf\Application Files\%(RecursiveDir)" />

<Copy SourceFiles="@(LicenseFile)" DestinationFolder="\\devscenmgrapp1\c$\InetPub\wwwroot\DocGen\bin" />

我在这里缺少什么,因为ENV1指向App.Config而不是App.ENV1.Config?

0 个答案:

没有答案