开发者

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开发者_JS百科 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.


You could download the source code of MVCContrib and inside the bin/AspNetMvc folder you will find the Microsoft.Web.Mvc assembly which is compiled against ASP.NET MVC 3.0.


It's been added to the MVC 3 RTM release now :

http://aspnet.codeplex.com/releases/view/58781#DownloadId=211128

The direct link is here :

http://aspnet.codeplex.com/releases/view/58781#DownloadId=211128


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜