Default Template Projects Crashing in Visual Studio 2013

524 views Asked by At

Am I doing something wrong or is Visual Studio 2013 default projects broken?

Create a new basic MVC project:

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".

Removed the lines causing the exceptions, nothing works. Installed WebGrease, Web.Optimization and DotNetOpenAuth extensions, Bootstrap (since it looked like CSS problems).

Looked like this had the solution but no luck: Could not load file or assembly 'WebGrease' or one of its dependencies

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:

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

and then fixing it with 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

trying to fix the webgrease error with installing the expected version instead causes this in the Console:

"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. And it's also very obviously not backwards compatible. WebGrease 1.6 will not work for 1.5.1.

1

There are 1 answers

0
Deukalion On BEST ANSWER

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".

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.

I reinstalled from Visual Studio 2013 Professional to Visual Studio 2013 for Web with Update 4, and same things happened in both versions. Probably the solution for both then.