gpt4 book ai didi

asp.net-mvc - 当 Copy-Local 设置为 True 时,为什么 Azure 部署中缺少 DLL?

转载 作者:行者123 更新时间:2023-12-02 07:30:59 25 4
gpt4 key购买 nike

我在 Visual Studio 2013 中设置了 ASP.NET MVC v4 项目。

我使用 Visual Studio Online 在 Git 中托管该项目。我使用 Azure 部署配置文件创建了一个构建定义,以便我可以运行自动构建,该构建也会自动部署站点。

但是,在明显成功的部署之后,我收到以下错误:

Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of itsdependencies. The system cannot find the file specified.

我已经通过FTP检查了该网站,System.Web.Mvc.dll文件肯定丢失了。

但是,MVC 是作为 NuGet 包安装的,为解决方案启用了 NuGet 包还原,并设置了“复制本地”作为引用。如果我在本地构建解决方案,则 DLL 会正确复制到输出文件夹。

我检查了 Visual Studio Online 构建日志,可以看到以下内容...

...

Installing 'Microsoft.AspNet.Mvc 4.0.30506.0'.

...

Successfully installed 'Microsoft.AspNet.Mvc 4.0.30506.0'.

...

所以 - 我不明白为什么 DLL 没有部署到 Azure。

任何帮助将不胜感激!

最佳答案

最新的 MVC 4 版本是 4.0.0.1。检查您的项目引用是否正确指向 NuGet 中的版本,而不是 GAC 中的版本。

这篇 MSDN 博客文章可能会有所帮助:http://blogs.msdn.com/b/webdev/archive/2014/10/16/microsoft-asp-net-mvc-security-update-broke-my-build.aspx

您还可以尝试将重定向添加到您的 web.config:

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0-4.0.0.1" newVersion="4.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

关于asp.net-mvc - 当 Copy-Local 设置为 True 时,为什么 Azure 部署中缺少 DLL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28928654/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com