就像this guy,我在创建MVC 4项目时没有创建单元测试项目。现在我想回去添加一个。将单元测试项目添加到ASP.Net MVC 4项目
为此,我创建了一个新的单元测试项目。为什么单位
Unit Test Generation Error: The following error was encountered while reading module 'My.Project': Could not resolve the type reference: [System.Web.Mvc, Version 3.0.0.0, Culture=neutral, PublicKeyToken={why doesn't MS support cut and paste??}]System.Web.Mvc.AllowAnonymousAttribute.
AllowAnonymousAttribute是新的MVC 4:
现在,我在一个私人的方法在我的控制器之一单击鼠标右键,选择创建单元测试,并得到一个弹出式对话框的认定尽管测试生成器试图解决MVC 3程序集?
My.Project编译并运行得很好,AllowAnonymousAttribute和all,显然是尊重System.Web.Mvc,版本4.0.0.0。
UPDATE
MyMvc.csproj包含
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\AspNetMvc.4.0.20126.16343\lib\net40\System.Web.Mvc.dll</HintPath>
</Reference>
在HintPath的DLL被证实为版本4.0.0.0
MyMvc.Test.csproj包含
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
这并没有解决问题。 –