当我手动将控制台应用程序发布为Azure webjob时,为什么不应用配置转换? [英] Why are config transforms not applied when I manually publish a console app as an Azure webjob?

查看:146
本文介绍了当我手动将控制台应用程序发布为Azure webjob时,为什么不应用配置转换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个控制台应用程序,正在作为Web Job部署到Azure.我可以从Visual Studio 2015中手动执行此操作,方法是右键单击项目,然后选择"

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

我现在需要将这个应用程序部署到几个不同的环境(例如:dev,test,prod等).在每种环境中,控制台应用程序都需要使用不同的配置设置来运行.

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.

要完成此操作,我已经安装了慢猎豹 v2.5.48,并设置多个配置转换文件-每个环境一个.

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.

当我通过VS中的发布"向导手动进行发布时(如上所述),我发现未应用配置转换.相反,目标应用程序服务上存在基本" .config文件.

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?

推荐答案

根据您的描述,我建议您首先检查您是否已经

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.

此外,我建议您可以打开.csproj文件,并确保App.dev.config标记的IsTransformFile为true.

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>

这篇关于当我手动将控制台应用程序发布为Azure webjob时,为什么不应用配置转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆