简体   繁体   English

Visual Studio 2013中的默认模板项目崩溃

[英]Default Template Projects Crashing in Visual Studio 2013

Am I doing something wrong or is Visual Studio 2013 default projects broken? 我是在做错什么,还是Visual Studio 2013默认项目坏了?

Create a new basic MVC project: 创建一个新的基本MVC项目:

File -> New -> Project
and
Templates / Visual C# / Web / ASP.Net Web Application
and
MVC with no Authentication

and immediately on running "template default empty project" I get 并立即运行“模板默认空项目”,我得到

Could not load file or assembly 'WebGrease, Version=1.5.1.25624....

Line 5:      <meta name="viewport" content="width=device-width, initial-scale=1.0">
Line 6:      <title>@ViewBag.Title - My ASP.NET Application</title>
Line 7:      @Styles.Render("~/Content/css")
Line 8:      @Scripts.Render("~/bundles/modernizr")
Line 9:  </head>

and with

Templates / Visual C# / Web / Visual Studio 2012 / ASP.Net Web MVC 4 Application

Razor, Internet Application with a Test Unit

I immediately on starting getting: 我立即开始:

Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0...

Well... This is default projects, which makes me wonder why I need to immediately fix anything before even doing anything. 好吧...这是默认项目,这使我想知道为什么我什至在做任何事情之前都需要立即修复任何问题。 It's fun, when you're experimenting needing to try to fix things before you even have begin coding. 这很有趣,当您尝试在甚至开始编码之前尝试尝试解决问题时。

This is Visual Studio 2013 Pro with everything installed and these are the "Default New Projects". 这是已安装所有内容的Visual Studio 2013 Pro,它们是“默认新项目”。

Removed the lines causing the exceptions, nothing works. 删除导致异常的行,没有任何效果。 Installed WebGrease, Web.Optimization and DotNetOpenAuth extensions, Bootstrap (since it looked like CSS problems). 安装了WebGrease,Web.Optimization和DotNetOpenAuth扩展,Bootstrap(因为它看起来像CSS问题)。

Looked like this had the solution but no luck: Could not load file or assembly 'WebGrease' or one of its dependencies 看起来像这样有解决方案,但没有运气: 无法加载文件或程序集“ WebGrease”或其依赖项之一

In short, if I need to fix every project before starting a new project - something must be wrong. 简而言之,如果我需要在开始新项目之前修复每个项目-一定有问题。

EDIT 编辑

Reinstalling and updating everything in the Nuget console makes both error above disappear, but then this happens: 在Nuget控制台中重新安装和更新所有内容会使上述两个错误消失,但是随后会发生这种情况:

'System.Web.Mvc, Version=5.2.0.0" exception

and then fixing it with Package Manager Console 然后使用Package Manager Console修复它

Install-Package Microsoft.AspNet.Mvc -Version 5.2.0.0

causes the WebGrease error to appear again and the Nuget console wants me the update the MVC again 导致WebGrease错误再次出现,并且Nuget控制台要我再次更新MVC

trying to fix the webgrease error with installing the expected version instead causes this in the Console: 尝试通过安装期望的版本来修复webgrease错误,而在控制台中导致以下错误:

"Install-Package : Updating 'WebGrease 1.6.0' to 'WebGrease 1.5.1' failed."

So for me, it does NOT work out of the box (with VS2013 Update 3 installed) and restarting a new project seems to make all updates disappear and all errors reappear again, having me to redo the whole process even though I've "seemingly" updated everything that I could update. 因此,对我而言,它无法立即使用(安装了VS2013 Update 3),并且重新启动新项目似乎会使所有更新消失并且所有错误再次出现,即使我“似乎”已经重新进行了整个过程”更新了我可以更新的所有内容。 And it's also very obviously not backwards compatible. 而且它显然也没有向后兼容。 WebGrease 1.6 will not work for 1.5.1. WebGrease 1.6不适用于1.5.1。

I finally managed to fix this but I have no clue as to why it is like it is. 我终于设法解决了这个问题,但是我不知道为什么会这样。

Creating a project on my external device which is also encrypted, where I'm storing most of my project is causing this error. 在我的外部设备上也加密的一个项目上创建一个项目,该项目在我将大部分项目存储在其中的情况下导致了此错误。

When I instead moved a project to an internal device, or created one there - it does not happen. 相反,当我将一个项目移至内部设备或在内部设备中创建一个项目时,它不会发生。

When I also move the project to the root folder of my device, it works also, which means something is wrong with my paths. 当我还将项目移到设备的根文件夹时,它也可以工作,这意味着我的路径有问题。 But I guess that kind of warning would be nicer to get rather than there are lots of assemblies not being able to load. 但是我想得到这样的警告会更好,而不是有很多程序集无法加载。 It's kind of the wrong error message. 这是错误的错误消息。 And as far as I can tell, the assemblies would probably be located at the install location and not in my project - so as to why this error happens I have no clue, files should still be accessible. 据我所知,程序集可能位于安装位置,而不是在我的项目中-因此,为什么我不知道为什么会发生此错误,仍然应该可以访问文件。

I noticed that it worked when creating a new Project in the default folders in My Document that it finally worked. 我注意到,当在“我的文档”的默认文件夹中创建一个新项目时,它终于可以工作了。

Maybe it's a bug including long folder names, but it's not that deeply located on the External Device. 也许这是一个包含长文件夹名称的错误,但是它不在外接控制器上的位置那么深。 5 Folder, with about 75 character length in the PATH to the folder where it's in. And I think that it's at least 256 characters before Windows start complaining about length of the "Path". 5文件夹,该文件夹所在的路径在PATH中大约有75个字符的长度。我认为Windows开始抱怨“路径”的长度之前,它至少为256个字符。

Well, anyhow. 好吧,无论如何。 If someone encounters error that are not really errors, check your folders and where it's at. 如果有人遇到的错误不是真正的错误,请检查您的文件夹及其位置。 I've had projects lots deeper than this in earlier version of Visual Studio and without complaints and errors. 我的项目比Visual Studio早期版本中的项目要深得多,并且没有抱怨和错误。

I reinstalled from Visual Studio 2013 Professional to Visual Studio 2013 for Web with Update 4, and same things happened in both versions. 我使用Update 4从Visual Studio 2013 Professional重新安装到了Visual Studio 2013 for Web,在两个版本中都发生了相同的事情。 Probably the solution for both then. 可能是两者的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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