在不同环境下进行web.config转换时出错 [英] Error doing web.config transformation for different environments

查看:118
本文介绍了在不同环境下进行web.config转换时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将我的应用程序部署到不同的环境中,然后我开始按照以下方法进行操作:

I was trying to deploy my app into different environments then i started following this how to: Deploying an ASP.NET Web Application to a Hosting Provider using Visual Studio or Visual Web Developer: Web.Config File Transformations - 3 of 12

在我单击预览转换之前,它是完美的,我收到此错误:

was perfect until I clicked in Preview Transform, I received this error:

Microsoft Visual Studio

无法加载文件或程序集"Microsoft.Web.XmlTransform,版本= 1.2.0.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a"或其依赖项之一.系统找不到指定的文件.

Could not load file or assembly 'Microsoft.Web.XmlTransform, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

(我只创建了一个转换 Web.DebugQA.config ,当然还创建了默认的转换和调试版本)

(I created just one transformation Web.DebugQA.config and of course the default ones, debug and release)

我的 Web.DebugQA.config 看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <connectionStrings>
    <add name="MyDB" 
      connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
      xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
  </connectionStrings>
  <system.web>
  </system.web>
  <appSettings>
    <add key="EnvironmentName" value="QADev" xdt:Transform="SetAttributes(value)"
      xdt:Locator="Match(key)" />
  </appSettings>
</configuration>

但随后我安装了此插件:

but then I install this plugin:

SlowCheetah-XML转换

我解决了我的预览转换错误,但是当我尝试使用QADev转换发布时,出现了这个错误:

and I solved my preview transform error, but then when I was trying to publish using the QADev transform I got this error:

"ImportParametersFile"任务意外失败.

The "ImportParametersFile" task failed unexpectedly.

System.IO.FileNotFoundException:无法加载文件或程序集"Microsoft.Web.XmlTransform,版本= 1.2.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a"或其依赖项之一.该系统找不到指定的文件. 文件名:'Microsoft.Web.XmlTransform,版本= 1..2.0.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a'
在Microsoft.Web.Publishing.Tasks.ImportParametersFile.Execute()
在Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
在Microsoft.Build.BackEnd.TaskBuilder中.< ExecuteInstantiatedTask> d__20.MoveNext()

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.XmlTransform, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Web.XmlTransform, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.Web.Publishing.Tasks.ImportParametersFile.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()

WRN:程序集绑定日志记录已关闭.
要启用程序集绑定失败日志记录,请将注册表值[HKLM\Software\Microsoft\Fusion!EnableLog](DWORD)设置为1.
注意:与程序集绑定失败日志记录相关的性能损失.
要关闭此功能,请删除注册表值[HKLM\Software\Microsoft\Fusion!EnableLog].

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

我正在使用Visual Studio Pro 2012.

I'm using Visual Studio Pro 2012.

推荐答案

我通过修复控制面板->程序和功能"中的"Microsoft ASP.NET和Web工具2013.1-Visual Studio 2012"来解决此问题.

I fixed this by repairing "Microsoft ASP.NET and Web Tools 2013.1 - Visual Studio 2012" from Control Panel --> Programs and Features.

路径C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v11.0 \ Web中缺少文件Microsoft.Web.XmlTransform.dll.

The file Microsoft.Web.XmlTransform.dll was missing from the path C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web.

这篇关于在不同环境下进行web.config转换时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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