Set*_*man 3 asp.net-mvc nuget asp.net-mvc-4 visual-studio-2012
我试图在没有在计算机上安装visual studio或MVC 4的情况下,在测试服务器上构建MVC解决方案.
该解决方案将所有必需的MVC程序集称为nuget包.在项目中,所有MVC程序集都标记为本地副本.当然,在我的开发机上,该解决方案在visual studio中构建得很好.
在构建机器上,我安装了.net sdk,我正在尝试使用MSBuild来构建解决方案.所有的nuget包都在源代码控制之下,当我在服务器上进行SVN更新时,它会获得所有的包.
当我运行构建时,我得到了对MVC DLL的破坏引用.我不明白为什么会发生这种情况,因为在解决方案中引用了DLL并且存在供构建使用.
以下是MSBuild返回的错误示例...
DataAnnotations\RunDataAnnotationsFromModelPropertyAttribute.cs(5,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
DataAnnotations\RunDataAnnotationsFromModelPropertyAttribute.cs(12,93): error CS0246: The type or namespace name 'IClientValidatable' could not be found (are you missing a using directive or an assembly reference?)
Security\MyAuthenticateAttribute.cs(6,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Security\MyAuthenticateAttribute.cs(12,48): error CS0246: The type or namespace name 'AuthorizeAttribute' could not be found (are you missing a using directive or an assembly reference?)
Security\MyAuthorizeAttribute.cs(5,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Security\MyAuthorizeAttribute.cs(13,45): error CS0246: The type or namespace name 'AuthorizeAttribute' could not be found (are you missing a using directive or an assembly reference?)
Web\Mvc\MyLoginController.cs(7,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Web\Mvc\MyLoginController.cs(44,62): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) ...
Run Code Online (Sandbox Code Playgroud)
我花了好几个小时.令我感到沮丧的是,它在我的机器上构建了visual studio,而不是在使用msbuild的服务器上构建.
赛斯
右键单击项目并单击"卸载",然后再次单击"编辑".
找到<Reference>的System.Web.Mvc.如果<HintPath>没有引用"packages"目录(或缺少),那那就是你的问题.只需删除包和所有引用,然后重新开始.
NuGet包还原仅还原磁盘上的文件,它不会更新项目引用.
| 归档时间: |
|
| 查看次数: |
4236 次 |
| 最近记录: |