简体   繁体   English

当我手动将控制台应用程序发布为Azure Webjob时,为什么不应用配置转换?

[英]Why are config transforms not applied when I manually publish a console app as an Azure webjob?

I have a console application that I am deploying to Azure as a Web Job. 我有一个控制台应用程序,它将作为Web Job部署到Azure。 I do this manually from Visual Studio 2015 by right-clicking the project and choosing " Publish as Azure WebJob ". 我可以从Visual Studio 2015中手动执行此操作,方法是右键单击项目,然后选择“ 发布为Azure WebJob ”。

I am now at a point where I need to deploy this app to several different environments (ex: dev, test, prod etc). 现在,我需要将该应用程序部署到几个不同的环境(例如:dev,test,prod等)。 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. 为此,我已经安装了Slow Cheetah v2.5.48并设置了多个配置转换文件-每个环境一个。

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. 当我通过VS中的“发布”向导手动进行发布时(如上所述),我发现未应用配置转换。 Instead, the "base" .config file are present on the target app service. 而是,目标应用程序服务上存在“基本” .config文件。

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. 根据您的描述,我建议您首先可以检查您是否已经构建了名为“ dev”,“ test”的配置 ,如下所示。

在此处输入图片说明

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. 此外,建议您打开.csproj文件,并确保App.dev.config标记的IsTransformFile为true。

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

我建议您尝试:

< xdt:Transform="Replace"> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在处理多个发布目标时,如何处理不同实例的多个web.config转换? - How do I handle multiple web.config transforms for different instances when dealing with multiple publish targets? 使用WebJob将Web App发布到Azure时遇到困难 - Stuck when publishing Web App to Azure with WebJob 解决方案配置,发布配置文件和web.config转换之间的关系 - Relationship between solution configuration, publish profile, and web.config transforms 发布控制台应用 - Publish Console App 在 Visual Studio 2013 中处理 app.config 的配置转换 - Handle config transforms for app.config in Visual studio 2013 如何将手动创建的WebJobs发布到Azure - How to publish manually created WebJobs to Azure 如何将控制台应用程序发布到可执 - How to publish console app into executable 将Web应用程序发布到Azure网站登台部署插槽失败,并显示webjob - Publishing web app to Azure Websites Staging deployment slot fails with webjob Azure:HOWTO/最佳实践:使用 Blob Q 将带有 Webjob 的 WebApp 发布到多个目的地? - Azure : HOWTO/BEST-Practice : Publish WebApp with Webjob using blobs Q's to multiple destinations? 在 Visual Studio 中发布 Azure 函数时包含文件 - Including a file when I publish my Azure function in Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM