Publish error: Could not load file or assembly 

2020-03-01 05:25发布

I want to publish a MVC project and I keep getting this error:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.XmlTransform', Version=1.4.0.0, Culture=neutral, PublicKeyToken=... or one of its dependencies. The system cannot find the file specified.

I have searched for and tried some solutions found on SO or MSDN to no avail. I'm really desperate for some suggestions. The project has been published successfully before, but this came out of the blue after trying to republish my updated version.

13条回答
在下西门庆
2楼-- · 2020-03-01 05:25

Repairing MS Web Tools for VS2012 did not solve the problem for me.

I have the files in the folder C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web (I do not know if this is because I have installed VS 2013 Express, or some other tool. Maybe installing the Web Tools for VS 2013 will create them).

Copying the files from v12.0 folder to v11.0 folder fixed the problem.

查看更多
乱世女痞
3楼-- · 2020-03-01 05:26

I had a nearly identical problem, except the publish was saying it couldn't find Newtonsoft.Json.dll, Version=4.5.0.0. I tried all of the above solutions before finally realizing that the file was missing from the package directory for Azure WebJobs Publish (apologies for not having the full name of the package at my fingertips). The solution was simply to empty my entire /packages/ folder and let them restore automatically.

查看更多
时光不老,我们不散
4楼-- · 2020-03-01 05:27

Had that problem also. What worked for me was:

查看更多
时光不老,我们不散
5楼-- · 2020-03-01 05:27

This may be an edge case, but I cloned I co-workers GIT repo containing a Visual Studio solution.

Visual Studio was reporting that the Microsoft.Web.XmlTransform.dll reference was broken.

Looking at the .csproj file for that project I found this:

<HintPath>..\..\..\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.XmlTransform.dll</HintPath>

This path must have been correct for my co-worker, but for me it was wrong. I corrected to this:

<HintPath>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.XmlTransform.dll</HintPath>


This occured with VS2015 (Version 14 Update 2).

查看更多
Evening l夕情丶
6楼-- · 2020-03-01 05:27

For me 'barca_d' solution worked but i also had to keep my projects

查看更多
Bombasti
7楼-- · 2020-03-01 05:27

Reinstall NuGet Package Microsoft.Web.Xdt

查看更多
登录 后发表回答