System.web.mvc失踪 [英] System.web.mvc missing

查看:538
本文介绍了System.web.mvc失踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个旧的ASP.NET MVC 3 Web应用程序,建设VS2010,却不能编译,因为上周的安全更新。

We have an old ASP.NET MVC 3 Web Application, building in VS2010, that fails to compile, since last week's security update.

的问题是,在参照System.Web.Mvc.dll程序被打破了。

The problem is that the reference to System.Web.Mvc.dll is broken.

当我打开我们的构建机器,那里的安全更新并没有运行,打开的属性对话框引用 - > System.Web.MVC的解决方案文件,它看起来就好了。

When I open the solution file on our build machine, where the security update has not run, and open the properties dialog for References->System.Web.MVC, it looks just fine.

路径是C:\\ Program Files文件\\微软ASP.NET \\ ASP.NET MVC 3 \\组件\\ System.Web.Mvc.dll程序
版本是3.0.0.0

Path is C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll Version is 3.0.0.0

但是,当我打开那里的安全更新运行一个dev的机器解决方案文件,引用 - > System.Web.MVC被标记为丢失。如果我将其删除,并尝试将其添加回使用VS2010的Add Reference对话框,它不显示。

But when I open the solution file on a dev machine where the security update has run, References->System.Web.MVC is flagged as missing. If I remove it, and try to add it back using VS2010's Add Reference dialog, it doesn't show.

在网路上徘徊,导致我的建议涉及使用的NuGet更新MVC。我们没有使用的NuGet,在我们的VS2010的项目,因此这似乎并不完全正确,因为这种情况。我试了一下,无论如何,并且结束了半年时间,十几丢失的引用。

Wandering around the web has led me to suggestions involving updating MVC using NuGet. We didn't use NuGet, in our VS2010 projects, so that doesn't seem quite right, for this situation. I tried it anyway, and ended up with half-a-dozen missing references.

当我看着属性:在Windows资源管理器C:\\ Program Files文件\\微软ASP.NET \\ ASP.NET MVC 3 \\组件\\ System.Web.Mvc.dll程序,在构建机上我看到3.0版.0.0。

When I look at the properties for "C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll" in Windows Explorer, on the build machine I see version 3.0.0.0.

当我看着dev的机器性能,我看到的版本3.0.50813.1。

When I look at the properties on the dev machine, I see version 3.0.50813.1.

我需要的是一种方法来改变我建立的方式和运行,这样我可以建立和运行,无论这些两个DLL在安装了.NET 3.0框架的。

What I need is a way to change the way I build and run so that I can build and run regardless of which of these two DLLs in installed in the .NET 3.0 framework.

想法?

第一次尝试 - 如果组件丢失,添加它。我删除了旧丢失的引用。然后,我从ASP.NET MVC3 \\程序集文件夹中复制DLL,到我的项目的文件夹。将其设置为一直拷贝,并将其添加为一个参考。

First attempt - if the assembly is missing, add it. I deleted the old missing reference. Then I copied the DLL from the "ASP.NET MVC3\Assemblies" folder, into a folder in my project. Set it as "Copy Always", and added it as a reference.

就这样,该项目将编译VS2010,但是当我想尝试precompile与aspnet_compiler的网页,我得到了警告:

With that, the project would compile in VS2010, but when I'd try to precompile the pages with aspnet_compiler, I got warnings:

(0): warning CS1702: Assuming assembly reference 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' matches 'System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35', you may need to supply runtime policy

到目前为止,我已经能够设法避免运行时认识的政策,但我想添加此,在web.config:

So far, I've been able to manage to avoid understanding runtime policies, but I tried to add this, in the web.config:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.1" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

再次试了一下,得到了同样的警告。

Tried it again, and got the same warnings.

我的问题是 - 我仍然有一个问题?或者将我解决这个问题,尽管警告?

My question is - do I still have a problem? Or will my resolve it, despite the warnings?

推荐答案

通过的NuGet获取最新版本的MVC3的。打开开发工作室项目。在开发工作室的底部打开包管理器控制台选项卡。然后使用这个命令:

Get the latest version of MVC3 via NuGet. Open your project in Dev Studio. Open the Package Manager Console tab at the bottom of Dev Studio. Then use this command:

PM> Install-Package Microsoft.AspNet.Mvc -Version 3.0.50813.1

如果您点击后,Tab键-Version,你会得到所有的可用版本的列表。

If you click the tab key after "-Version" you will get a list of all of the available versions.

如果你有一个旧版本的NuGet你可能会指示你必须升级错误。如果是这样,打开工具 - >扩展管理器安装最新版本的NuGet的。请注意,您将需要运行开发工作室以管理员身份,然后才能安装的NuGet。

If you have an old version of NuGet you may get an error indicating you have to upgrade it. If so, open Tools->Extension Manager to install the latest version of NuGet. Note, you will need to run Dev Studio as Administrator before you can install NuGet.

安装MVC3应该在你的项目更新Web.config文件。

Installing MVC3 should update Web.config in your project.

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.1" newVersion="3.0.0.1" />
  </dependentAssembly>
</assemblyBinding>

这篇关于System.web.mvc失踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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