Why are config transforms not applied when I manua

2019-07-24 23:53发布

问题:

I have a console application that I am deploying to Azure as a Web Job. I do this manually from Visual Studio 2015 by right-clicking the project and choosing "Publish as Azure WebJob".

I am now at a point where I need to deploy this app to several different environments (ex: dev, test, prod etc). In each environment the console app needs to run with different config settings.

To get this done, I've installed Slow Cheetah v2.5.48 and setup multiple config transform files - one for each environment.

I've also created dedicated publish profiles in my project - one for each environment - and I've made sure the profile names match the names of the config transform files.

When I manually publish via the Publish wizard in VS (as described above), I find that the config transforms are not applied. Instead, the "base" .config file are present on the target app service.

Why are the transforms not applied when publishing this way and how can I fix that?

回答1:

According to your description, I suggest you could firstly check you have already build configuration called "dev" ,” test” like below.

Then I suggest you could check you have a right app config file in your project like below.

At last, you could make sure you have select the right build configuration.

Besides, I suggest you could open your .csproj file and ensure that the App.dev.config tag’s IsTransformFile is true.

<None Include="App.dev.config">
      <DependentUpon>App.config</DependentUpon>
      <IsTransformFile>True</IsTransformFile>
    </None>


回答2:

I would suggest you try with:

< xdt:Transform="Replace">