0

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.

Community
  • 1
  • 1
Deukalion
  • 2,516
  • 9
  • 32
  • 50
  • All assemblies that are requested are also in the Reference list. – Deukalion Nov 12 '14 at 16:45
  • Have you tried reinstalling Visual Studio? – Matthijs Nov 12 '14 at 16:45
  • I just installed it. Happened out of the box. Been trying the whole day now to get it working. – Deukalion Nov 12 '14 at 16:47
  • This could mean a corrupted download. Try redownloading and reïnstalling. – Matthijs Nov 12 '14 at 16:48
  • Did you try to update the packages through nuget manager? – blfuentes Nov 12 '14 at 16:48
  • I've installed from a DVD from my school and as far as I can tell, it were the latest stable updates. – Deukalion Nov 12 '14 at 16:49
  • 1
    but the packages you use in the project should be updated with the nuget manager. Go to Tools->Nuget Package Manager->Manage Nuget Packages. And check in updates if you have newer versions. Also update your IDE and extensions: Tools->Extensions and Updates – blfuentes Nov 12 '14 at 16:52
  • Doing a reinstall first, if that doesn't help - I'll try that too. – Deukalion Nov 12 '14 at 16:56
  • Did a reinstall, same problem. Did an update, now I get "Could not load file or assembly 'System.Web.Mvc, Version=5.2.0.0" exception... :-/ – Deukalion Nov 13 '14 at 08:48
  • So updating all NuGet packages means I need a new version of MVC, but it's not available at default. Looks to me like they've really screwed everthing up with Visual Studio 2013. But updating through the NuGet console, it's already at 5.2.2... And tried recreating a new project afterwards, but seems like these updates need to be applied to all projects - because after updating, I get the same errors on a new Project. This is making my head hurt and it's not really an effective way to handle updates, extensions, addons and whatever. – Deukalion Nov 13 '14 at 09:04
  • Fixing the error for the "System.Web.MVC Version=5.2.0.0" exception is fixed by just installing "5.2.0.0" in the Nuget console but then I get WebGrease Exception again. Trying to install that exact version the console gives me "Install-Package : Updating 'WebGrease 1.6.0' to 'WebGrease 1.5.1' failed." - So what now? It doesn't seem backwards compatible and every error causes another error. And it does NOT work out of the box. It's just a loop of errors. If I had just been able to run it on default versions I'd be glad. But seems that nothing works. Best Visual Studio ever! – Deukalion Nov 13 '14 at 09:15

1 Answers1

0

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.

Deukalion
  • 2,516
  • 9
  • 32
  • 50