当我尝试在同一解决方案中使用MVC Futures库和ASP.NET MVC源代码时出错

时间:2022-05-24 15:27:14

I get the following error when attempting to use both the MVC Futures library (Microsoft.Web.Mvc) and the ASP.NET MVC source code in the same solution:

尝试在同一解决方案中同时使用MVC Futures库(Microsoft.Web.Mvc)和ASP.NET MVC源代码时出现以下错误:

The type 'System.Web.Mvc.Controller' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

类型'System.Web.Mvc.Controller'在未引用的程序集中定义。您必须添加对程序集'System.Web.Mvc,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'的引用。

I have removed the GAC reference to System.Web.Mvc in the Web.config file so that the project will use the project reference to the MVC source code. Any idea how to get around this?

我已经删除了Web.config文件中对System.Web.Mvc的GAC引用,以便项目将使用对MVC源代码的项目引用。知道怎么解决这个问题吗?

2 个解决方案

#1


I think that the problem is that your application and the version of the Futures library you are using reference different versions of the System.Web.Mvc assembly. You need to examine every assembly involve carefully, and make sure the dependencies align. This may require getting a new version of Futures or removing System.Web.Mvc from the GAC, depending upon the precise nature of the problem you uncover.

我认为问题在于您的应用程序和您正在使用的Futures库的版本引用了System.Web.Mvc程序集的不同版本。您需要仔细检查每个程序集,并确保依赖项对齐。这可能需要获取新版本的Futures或从GAC中删除System.Web.Mvc,具体取决于您发现的问题的确切性质。

I'm going to dispute this bit of the question:

我要对这个问题提出质疑:

I have removed the GAC reference to System.Web.Mvc in the Web.config file so that the project will use the project reference to the MVC source code.

我已经删除了Web.config文件中对System.Web.Mvc的GAC引用,以便项目将使用对MVC源代码的项目引用。

Removing this doesn't always seem to stop the ASP.NET compiler (different from the VS compiler) from finding the MVC assembly in the GAC. We ran into just this problem when trying to make projects built with RC 1 and Preview 5 coexist.

删除它似乎并不总是阻止ASP.NET编译器(与VS编译器不同)在GAC中找到MVC程序集。在尝试使用RC 1和Preview 5共存的项目时,我们遇到了这个问题。

#2


So does this work if you remove the reference to the MVC Futures assembly? As far as I know, the Microsoft.Web.Mvc namespace doesn't override the System.Web.Mvc.Controller class, and hence shouldn't conflict with the actual MVC assembly..

如果删除对MVC Futures程序集的引用,这样做有用吗?据我所知,Microsoft.Web.Mvc命名空间不会覆盖System.Web.Mvc.Controller类,因此不应与实际的MVC程序集冲突。

#1


I think that the problem is that your application and the version of the Futures library you are using reference different versions of the System.Web.Mvc assembly. You need to examine every assembly involve carefully, and make sure the dependencies align. This may require getting a new version of Futures or removing System.Web.Mvc from the GAC, depending upon the precise nature of the problem you uncover.

我认为问题在于您的应用程序和您正在使用的Futures库的版本引用了System.Web.Mvc程序集的不同版本。您需要仔细检查每个程序集,并确保依赖项对齐。这可能需要获取新版本的Futures或从GAC中删除System.Web.Mvc,具体取决于您发现的问题的确切性质。

I'm going to dispute this bit of the question:

我要对这个问题提出质疑:

I have removed the GAC reference to System.Web.Mvc in the Web.config file so that the project will use the project reference to the MVC source code.

我已经删除了Web.config文件中对System.Web.Mvc的GAC引用,以便项目将使用对MVC源代码的项目引用。

Removing this doesn't always seem to stop the ASP.NET compiler (different from the VS compiler) from finding the MVC assembly in the GAC. We ran into just this problem when trying to make projects built with RC 1 and Preview 5 coexist.

删除它似乎并不总是阻止ASP.NET编译器(与VS编译器不同)在GAC中找到MVC程序集。在尝试使用RC 1和Preview 5共存的项目时,我们遇到了这个问题。

#2


So does this work if you remove the reference to the MVC Futures assembly? As far as I know, the Microsoft.Web.Mvc namespace doesn't override the System.Web.Mvc.Controller class, and hence shouldn't conflict with the actual MVC assembly..

如果删除对MVC Futures程序集的引用,这样做有用吗?据我所知,Microsoft.Web.Mvc命名空间不会覆盖System.Web.Mvc.Controller类,因此不应与实际的MVC程序集冲突。