C# 运行时错误:无法加载文件或程序集“System.Web.WebPages.Razor,版本=3.0.0.0”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19959406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Runtime error: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0
提问by Codes with Hammer
I tinkered with my ASP.NET MVC4 packages via NuGet, and now System.Web.WebPages.Razor v3
won't load. Sometimes other packages won't load either.
我通过 NuGet 修改了我的 ASP.NET MVC4 包,现在System.Web.WebPages.Razor v3
无法加载。有时其他包也不会加载。
My coworker runs the solution without any trouble, so the issue is definitely configuration on my development system (as opposed to anything that's been checked in).
我的同事毫无困难地运行了该解决方案,因此问题肯定是我的开发系统上的配置(而不是已签入的任何内容)。
I have already tried the recommendations at various SOf and other fora links, including:
我已经尝试了各种 SOF 和其他论坛链接上的建议,包括:
- Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0,
- Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0
- Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0
- 无法加载文件或程序集“System.Web.WebPages.Razor,版本=2.0.0.0,
- 无法加载文件或程序集“System.Web.WebPages.Razor,版本=2.0.0.0
- 无法加载文件或程序集“System.Web.WebPages.Razor,版本=3.0.0.0
As well as suggestions linked from there. I also checked the Control Panel and found no installed programs that referenced MVC. (If it matters, I'm running MS Win 7 SP 1.)
以及从那里链接的建议。我还检查了控制面板,没有发现引用 MVC 的已安装程序。(如果重要的话,我正在运行 MS Win 7 SP 1。)
I am open to any and all suggestions.
我愿意接受任何和所有建议。
Here's my core dump info:
这是我的核心转储信息:
Server Error in '/' Application.
Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.WebPages.Razor,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
=== Pre-bind state information === LOG: User = CodesWithHammer LOG: DisplayName = System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/ LOG: Initial PrivatePath = c:\users\CodesWithHammer\documents\visual studio 2012\Projects\MPP\MPP\bin Calling assembly : Microsoft.Web.WebPages.OAuth, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
=== LOG: This bind starts in default load context. LOG: Using application configuration file: c:\users\CodesWithHammer\documents\visual studio 2012\Projects\MPP\MPP\web.config LOG: Using host configuration file: C:\Users\CodesWithHammer\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor.DLL. LOG: Attempting download of new URL file:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor/System.Web.WebPages.Razor.DLL. LOG: Attempting download of new URL file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor.DLL. LOG: Attempting download of new URL file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor/System.Web.WebPages.Razor.DLL. LOG: Attempting download of new URL file:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor.EXE. LOG: Attempting download of new URL file:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor/System.Web.WebPages.Razor.EXE. LOG: Attempting download of new URL file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor.EXE. LOG: Attempting download of new URL file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor/System.Web.WebPages.Razor.EXE.
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.] Microsoft.Web.WebPages.OAuth.PreApplicationStartCode.Start() +0
[InvalidOperationException: The pre-application start initialization method Start on type
Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..] System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection
1 methods, Func
1 setHostingEnvironmentCultures) +550 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90 System.Web.Compilation.BuildManager.ExecutePreAppStart() +135 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516[HttpException (0x80004005): The pre-application start initialization method Start on type
Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055
“/”应用程序中的服务器错误。
无法加载文件或程序集“System.Web.WebPages.Razor,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。该系统找不到指定的文件。
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。
异常详细信息:System.IO.FileNotFoundException:无法加载文件或程序集“System.Web.WebPages.Razor,版本=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。该系统找不到指定的文件。
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of
可以使用下面的异常堆栈跟踪来识别异常。
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.WebPages.Razor,
版本=3.0.0.0,文化=中性,PublicKeyToken=31bf3856ad364e35' 无法加载。
=== 预绑定状态信息 === LOG: User = CodesWithHammer LOG: DisplayName = System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/ LOG: Initial PrivatePath = c:\users\CodesWithHammer\documents\visual studio 2012\Projects\MPP\MPP\bin Calling程序集:Microsoft.Web.WebPages.OAuth,版本=3.0.0.0,文化=中性,PublicKeyToken=31bf3856ad364e35。
=== LOG:此绑定在默认加载上下文中启动。日志:使用应用程序配置文件:c:\users\CodesWithHammer\documents\visual studio 2012\Projects\MPP\MPP\web.config 日志:使用主机配置文件:C:\Users\CodesWithHammer\Documents\IISExpress\config\aspnet .config LOG:使用来自 C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config 的机器配置文件。日志:后政策参考:System.Web.WebPages.Razor,版本=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35 日志:正在尝试下载新的 URL 文件:///C:/Users/CodesWithHammer/AppData/Local /Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor.DLL。日志:正在尝试下载新的 URL 文件:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP。NET 文件/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor/System.Web.WebPages.Razor.DLL。日志:正在尝试下载新的 URL 文件:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor.DLL。日志:正在尝试下载新的 URL 文件:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor/System.Web.WebPages.Razor.DLL . 日志:正在尝试下载新的 URL 文件:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor.EXE。日志:正在尝试下载新的 URL 文件:///C:/Users/CodesWithHammer/AppData/Local/Temp/Temporary ASP.NET Files/root/5bf3ca07/f960d9c5/System.Web.WebPages.Razor/System.Web.WebPages .Razor.EXE。日志:尝试下载新的 URL 文件:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor.EXE。日志:正在尝试下载新的 URL 文件:///c:/users/CodesWithHammer/documents/visual studio 2012/Projects/MPP/MPP/bin/System.Web.WebPages.Razor/System.Web.WebPages.Razor.EXE .
堆栈跟踪:
[FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' 或其依赖项之一。系统找不到指定的文件。] Microsoft.Web.WebPages.OAuth.PreApplicationStartCode.Start() +0
[InvalidOperationException: The pre-application start initialization method Start on type
Microsoft.Web.WebPages.OAuth.PreApplicationStartCode 引发异常并显示以下错误消息:无法加载文件或程序集“System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或其中之一它的依赖。系统找不到指定的文件..] System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection
1 methods, Func
1 setHostingEnvironmentCultures) +550 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 个方法) +132 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90 System.Web.Compilation.BuildManager.ExecutePreAppStart() +133 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516[HttpException (0x80004005): The pre-application start initialization method Start on type
Microsoft.Web.WebPages.OAuth.PreApplicationStartCode 引发异常并显示以下错误消息:无法加载文件或程序集“System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或其中之一它的依赖。系统找不到指定的文件..] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
版本信息:Microsoft .NET Framework 版本:4.0.30319;ASP.NET 版本:4.0.30319.18055
(For those who read this far: I don't have enough reputation to make the tag pulling-out-my-hair. If there's an appropriate extant tag, please include that. KTHX.)
(对于那些读到这里的人:我没有足够的声誉来制作标签pull-out-my-hair。如果有合适的现存标签,请包括它。KTHX。)
ETA: When I tried manually updating Microsoft.AspNet.Mvc
to version 3, here's the error I got on Package Manager Console:
ETA:当我尝试手动更新Microsoft.AspNet.Mvc
到版本 3 时,这是我在包管理器控制台上遇到的错误:
Install failed. Rolling back... Install-Package : Updating 'Microsoft.AspNet.Mvc 5.0.0' to 'Microsoft.AspNet.Mvc 3.0.20105.1' failed. Unable to find a version of 'Microsoft.AspNet.Mvc.FixedDisplayModes' that is compatible wi th 'Microsoft.AspNet.Mvc 3.0.20105.1'. At line:1 char:16 + Install-Package <<<< Microsoft.AspNet.Mvc -Version 3.0.20105.1 + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
安装失败。正在回滚...安装包:将“Microsoft.AspNet.Mvc 5.0.0”更新为“Microsoft.AspNet.Mvc 3.0.20105.1”失败。无法找到与“Microsoft.AspNet.Mvc 3.0.20105.1”兼容的“Microsoft.AspNet.Mvc.FixedDisplayModes”版本。在第 1 行字符:16 + Install-Package <<<< Microsoft.AspNet.Mvc -Version 3.0.20105.1 + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException +fullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands .InstallPackage 命令
ETA2: I got the packages directory from my coworker. They have MS.AspNet.Mvc
v5, and they're running just fine. But they ALSO have MS.AspNet.Mvc.FixedDisplayModes
v5. So I'm going to add both of those in. And yes, I have backed up my entire solution. :)
ETA2:我从我的同事那里得到了包目录。他们有MS.AspNet.Mvc
v5,他们运行得很好。但他们也有MS.AspNet.Mvc.FixedDisplayModes
v5。所以我要把这两个都加进去。是的,我已经备份了我的整个解决方案。:)
ETA3: So I re-upgraded to AspNet MVC v5, and skipped the deprecated Mvc.FixedDisplayNodes. Then I got a problem with conflicting versions of AspNet.WebPages, so I used this fix: Conflicting versions of ASP.NET Web Pages detected: specified version is "1.0.0.0", but the version in bin is "2.0.0.0" in ASP.MET MVC 3
ETA3:所以我重新升级到 AspNet MVC v5,并跳过了已弃用的 Mvc.FixedDisplayNodes。然后我遇到了 AspNet.WebPages 版本冲突的问题,所以我使用了这个修复: Conflicting versions of ASP.NET Web Pages detected: specified version is "1.0.0.0", but the version in bin is "2.0.0.0" in ASP.MET MVC 3
And now my project runs!
现在我的项目运行了!
Thanks all for the help!
感谢大家的帮助!
回答by fejesjoco
Is there a System.Web.WebPages.Razor.dll in the bin folder of your web app? What is its version? (Explorer right click, properties) I'm guessing it's not 3.0.0.0. Just get the nuget packages for v3.0.0.0, perhaps by copying the packages folder from your colleague. Or install it manually: http://www.nuget.org/packages/Microsoft.AspNet.Mvc/3.0.20105.1
您的 Web 应用程序的 bin 文件夹中是否有 System.Web.WebPages.Razor.dll?它的版本是什么?(资源管理器右键单击,属性)我猜它不是 3.0.0.0。只需获取 v3.0.0.0 的 nuget 包,也许通过从您的同事那里复制包文件夹。或者手动安装:http: //www.nuget.org/packages/Microsoft.AspNet.Mvc/3.0.20105.1
EDIT: if you copy stuff from your colleague, also copy the relevant version numbers into packages.config. This is what tells nuget which versions to put into the packages folder.
编辑:如果您从同事那里复制内容,请将相关版本号复制到packages.config 中。这就是告诉 nuget 将哪些版本放入包文件夹的原因。
回答by MichaelEvanchik
same thing JUST happened to me with NUGET.
同样的事情就发生在我身上 NUGET。
the following tag helped
以下标签有帮助
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" PublicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
Also if this is happening on the server, I had to make sure I was running the application pool on a more "privileged account" to the file system, but I don think that's your issue here
此外,如果这发生在服务器上,我必须确保我在文件系统的“特权帐户”上运行应用程序池,但我认为这是您的问题
回答by wim boone
in the new actionmailer, "razorengine" is a dependency. The latest version of Razorengine installs the dependency to System.Web.Razor 3.0.0.
在新的 actionmailer 中,“razorengine”是一个依赖项。Razorengine 的最新版本安装了对 System.Web.Razor 3.0.0 的依赖。
If you use an earlier version in your application (i suppose you are using actionmailer in another project and that you reference the mail functionality from another project) than you get this issue of course.
如果您在应用程序中使用早期版本(我假设您在另一个项目中使用 actionmailer 并且您引用了另一个项目的邮件功能),那么您当然会遇到这个问题。
In an earlier application, i had a webapplication MVC that uses system.web.Razor version 2.0.0. Of course, i got the issue to. How to fix? => Simple!
在早期的应用程序中,我有一个使用 system.web.Razor 2.0.0 版的 webapplication MVC。当然,我得到了这个问题。怎么修?=> 简单!
- Just uninstall the entire actionmailer in your actionmailer project.
- Install a previous version of RazorEngin
Install-Package RazorEngine -Version 3.3.0 (because version 3.3.0 will reference system.web.razor 2.0.0)
- Install actionmailer again (it will not install the latest version of RazorEngin because you allready did that yourselve)
- 只需在您的 actionmailer 项目中卸载整个 actionmailer。
- 安装以前版本的 RazorEngin
Install-Package RazorEngine -Version 3.3.0(因为 3.3.0 版将引用 system.web.razor 2.0.0)
- 再次安装 actionmailer(它不会安装最新版本的 RazorEngin,因为你自己已经这样做了)
回答by Craig Howard
You can find it in Nuget Package Microsoft ASP.NET Web Pages Version 3.2.0
您可以在 Nuget Package Microsoft ASP.NET Web Pages Version 3.2.0 中找到它
If you have a reference to an earlier version than 3.0.0.0, Delete the reference, add the reference to the correct .dll in your packages folder and make sure "Copy Local" is set to "True" in the properties of the .dll.
如果您有对 3.0.0.0 之前版本的引用,请删除该引用,在包文件夹中添加对正确 .dll 的引用,并确保在 .dll 的属性中将“Copy Local”设置为“True” .
Then in your web.config (as mentioned by @MichaelEvanchik)
然后在您的 web.config 中(如@MichaelEvanchik 所述)
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" PublicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
回答by Rajshekar Reddy
In my case the issue didn't resolve by following any of the above methods. I had all the paths in my package config correct and the dll's were in place as referred, I was still getting run time error for System.Web.WebPages.Razor. I changed the localhost port number and this worked
在我的情况下,通过上述任何方法都无法解决问题。我的包配置中的所有路径都是正确的,并且 dll 的位置如所指,我仍然收到 System.Web.WebPages.Razor 的运行时错误。 I changed the localhost port number and this worked
I am not sure of why I had the issue and why changing the port number resolved it. Just posting this as I feel this might be useful for someone out there.
我不确定为什么我会遇到这个问题以及为什么更改端口号可以解决它。只是发布这个,因为我觉得这可能对那里的人有用。
回答by Rajshekar Reddy
"Update-Package –reinstall Microsoft.AspNet.WebPages"
“更新包 - 重新安装 Microsoft.AspNet.WebPages”
Reinstall Microsoft.AspNet.WebPages nuget packages using this command in the package manager console. 100% work!!
在包管理器控制台中使用此命令重新安装 Microsoft.AspNet.WebPages nuget 包。100%工作!
回答by Null Reference
In my case, the issue was not about binding redirects or missing/mismatched Microsoft.AspNet.Razor package/dlls, so the above solutions didn't work.
就我而言,问题不在于绑定重定向或丢失/不匹配的 Microsoft.AspNet.Razor 包/dll,因此上述解决方案不起作用。
The issue, in my non-web project, was that RazorEngine+Microsoft.AspNet.Razor were installed in a different project (Project A) than the calling assembly/start-up project (Project B). Because there's no explicit reference to Razor, the System.Web.Razor did NOT get copied to /binin a Release build.
在我的非 Web 项目中,问题是 RazorEngine+Microsoft.AspNet.Razor 安装在与调用程序集/启动项目(项目 B)不同的项目(项目 A)中。因为没有显式引用 Razor,所以System.Web.Razor在 Release 版本中没有被复制到 /bin。
The solution was to Install RazorEngine+Microsoft.AspNet.Razor in the application entry point(Project B, ConsoleApplication in my case), then the System.Web.Razor gets copied to /bin and everyone's happy.
解决方案是在应用程序入口点安装 RazorEngine+Microsoft.AspNet.Razor(在我的例子中是项目 B,ConsoleApplication),然后 System.Web.Razor 被复制到 /bin 并且每个人都很高兴。
回答by Abhishek sharma
I got the same error, what worked for me is:
我遇到了同样的错误,对我有用的是:
- Fix references error.
- Close Visual Studio.
- Delete Packages.
- Delete .vs folder.
- Run Project Again.
- Rebuild Project.
- 修复引用错误。
- 关闭 Visual Studio。
- 删除包。
- 删除 .vs 文件夹。
- 再次运行项目。
- 重建项目。
回答by Shantu
I did not want to install visual studio and development environment, so I have installed AspNetMVC4Setup.exe in Windows server 2016 machine and it solved the problem. The installer was downloaded from Microsoft website.
我不想安装visual studio和开发环境,所以我在Windows server 2016机器上安装了AspNetMVC4Setup.exe,它解决了问题。安装程序是从 Microsoft 网站下载的。
回答by Guo Huang
I got this problem because I uninstalled VS 2012, I don't want to reinstall it back, so I downloaded the AspNetMVC4Setup.exe from Microsoft.com and fixed my problem.
我遇到这个问题是因为我卸载了 VS 2012,我不想重新安装它,所以我从 Microsoft.com 下载了 AspNetMVC4Setup.exe 并解决了我的问题。
https://www.microsoft.com/en-us/download/details.aspx?id=30683
https://www.microsoft.com/en-us/download/details.aspx?id=30683