Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error doing web.config transformation for different environments

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.

like image 219
ddieppa Avatar asked Feb 08 '13 16:02

ddieppa


2 Answers

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.

like image 192
Colin Banbury Avatar answered Oct 28 '22 20:10

Colin Banbury


I had a similar error, although it was caused for different reasons.

I solved it copying the following DLL from another PC with VS2012 installed: Microsoft.Web.XmlTransforms.dll

from: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web

I hope this helps

like image 31
Daniel Silva Avatar answered Oct 28 '22 20:10

Daniel Silva