简体   繁体   中英

MVC3 RTM Futures - Installing Microsoft.Web.Mvc

I'm trying to get futures running for Mvc3 RTM. There is no .dll included after installing mvc3 from webPI.

I've downloaded the source and have tried to build it myself, but when I drop it into my solution and add the namespace to the web.config under the Views folder I get the following error on every page:

S0012: 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=3.0.0.0, Culture=neutral, PublicKeyToken=null'.

I guess it's because because of strong naming or something along those lines.

How can I get up and running with futures?

Edit:

1) I might be wrong, but from memory, when you downloaded and installed previous versions of MVC, it would give you a Microsoft.Web.Mvc .dll under Program File/Microsoft ASP.NET/Asp .net MVC2. With WebPI install, there is only System.Web.Mvc.dll in that location.

2) It is definitely not in the GAC... it's not the place for this assembly (I also checked just to make sure)

3) The project that is not working is the target project. I created a new 'Asp .net Mvc 3 Application' ran it to make sure it worked (it did). Then I added a reference to the assembly I built from the Mvc 3 Source Code and altered the web.config under the 'Views' folder.

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
  <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="Microsoft.Web.Mvc" />
  </namespaces>
</pages>

4) As soon as I remove the namespace element and the dll, the project works again.

您可以下载MVCContrib源代码,bin/AspNetMvc文件夹中,您将找到针对ASP.NET MVC 3.0编译的Microsoft.Web.Mvc程序集。

When you build the MvcFutures project you'll have to replace the references of System.Web.Mvc and System.Web.WebPages to those in GAC otherwise you'll have to build your target project against the Mvc source code you downloaded.

Both options should work fine for you.

You need to include the assembly in the web.config as well as the namespace - if you started with an mvc2 project you probably have a line in there like

That will need to change to 3.0 of course, and you may also need to update the binding redirect.

When you say there is no dll included, have you checked the gac? If it is there you don't need a file locally for the system to find it based on strong name.

If you have built from source and therefore your version has a different strong name, you may have issues with third party components that reference an official build, but as long as the name in web config matches you should be ok for the core stuff. You'll want to add your own key so that the token isn't null though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM