Error doing web.config transformation for different environments

ddieppa picture ddieppa · Feb 8, 2013 · Viewed 8.7k times · Source

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

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.

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

my Web.DebugQA.config looks like this:

<?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 Transforms

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

The "ImportParametersFile" task failed unexpectedly.

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: 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].

I'm using Visual Studio Pro 2012.

Answer

Colin Banbury picture Colin Banbury · May 22, 2014

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

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