Default Template Projects Crashing in Visual Studio 2013 - c#

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.

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.

Related

Visual Studio 2015 - Multiple Versions in Multiple Windows Won't Build

I use the Microsoft Recommended way of structuring my solutions:
https://msdn.microsoft.com/en-us/library/bb668992.aspx
Typically I work off the main branch, and occasionally I open a older release. When I'm working I often have the Main branch open in one VS window, and an older release open in the other, something like this:
Visual Studio Window 1 - Main Solution(Solution containing: Web Site with several other Main Class Libraries)
Visual Studio Window 2 - Release 2.0.0(Solution containing: 2.0.0 Web Site with several other Version 2.0.0 Class Libraries)
Often times when I have both windows open, Visual Studio becomes confused between the two of them. For example, I build the 2.0.0 version of my website and then attempt to build the main site, the main site build will fail referencing a missing object that clearly exists within the project but not in the older version(2.0.0):
(Reference exists in Main branch, but not in 2.0.0)
My work around to this issue is to close both Visual Studio windows and then reopen only the main branch, rebuild, and everything works correctly.
It appears as though Visual Studio is confusing the two projects. Is there a way to get around this issue without closing both windows?
Update 1
I've tested this on VS 2017 and it doesn't seem to be occurring, I've also changed my folder schema since I first encountered this behavior.

.NET Core MVC 6 misleading IntelliSense

While trying to build a web app using .NET Core, I used the Web App template and while everything works exactly as one would expect, the IntelliSense on .cshtml pages is extremely misleading. It doesn't recognize #ViewData, #model, or #Model tags, but when a view model is added or a ViewData message is used, the project compiles and runs as normal. However, IntelliSense marks them red like so...
... and says "Cannot resolve symbol" even when using Microsoft's own .NET Core web application template in a fully updated Visual Studio 2015, will all necessary NuGet packages installed. Does anyone know if this is a bug that needs to be fixed or there's a definitive checklist of NuGet packages to add? Adding various Mvc.Tooling and Tooling.Razer packages only enables tag helpers, but anything other than code after an # on a .cshtml file is still flagged as an error...
[SOLVED] Please see answer...
After deleting everything from C:\Users[me]\AppData\Local\Microsoft\Visual Studio and VSCommon, then running devenv /resetuserdata in the Visual Studio Command Prompt, singing back in, and restoring my environment, the issue resolved itself.
Still not sure whats wrong, but it seems too complex to me to figure out on my own without deeper knowledge of VS 2015...

VS 2015 w/ Xamarin: This item does not support previewing

I'm using Visual Studio 2015 with Xamarin 4.1.2.18 and CocosSharp PCL 1.6.2.
When I try to access the Properties of the Android project by clicking on the "Properties" item in the Solution Explorer, this error pops up:
If I also right click on the project itself and select "Properties", it displays "This item does not support previewing".
It should be opening up to this page:
I have (supposedly) the latest build and Update 3. I have reinstalled it 3 times now.
Normal uninstaller. Reinstalled... nothing, still broken.
Uninstall again with cmd: /uninstall /force, use registry cleaners, manually uninstall components from Control Panel, manually delete folders. Reinstall... still broken.
Finally, I searched around and found this: Microsoft Visual Studio Uninstaller. After I, again, performed all the steps of 2, I used this tool and it found 52 additional things to clean up. I thought I finally had fixed it. Nope. The properties thing is still broken.
I have tried running as administrator. Nope.
I have deleted the ComponentModelCache in local AppData. Nope.
I have deleted the .suo file. Nope.
I know it has nothing to do with the project files because we have all the files synced with Git and my friend can view the properties page fine on his computer.
Does anybody know how I can fix this?
Is there some way to gather more information on the error?
Any Visual Studio error logs?
Also, on an semi-unrelated note:
When I try to build the Android project, I get errors saying that the $(TargetFrameworkVersion) for my references/dependencies is v4.2 and the $(TargetFrameworkVersion) of my project is v2.3. I checked my TargetFrameworkVersion property in the .csproj file and it's v6.0!
So, something is seriously wrong with this build of Visual Studio or something.
I've been considering just installing Visual Studio on a VM just to be sure.
Solution:
In the Android SDK manager, I had Android 4.0 (API 14) downloaded. Once I switched to Android 4.2.2 (API 17) everything started working.
I just gotta say, the error that it gave me is the most convoluted error message that I've ever received in the history of my programming career.

Migrating shared project from VS 2013 to 2015

We have a solution on VS 2013 that contains a shared code project type (https://github.com/firstfloorsoftware/mui).
We made some minor changes in this code and it has being part of our solution for a while.
Now I want to open this project in VS 2015. Although I had a minor problem with the shared project that seems to be fixed: https://github.com/firstfloorsoftware/mui/issues/48
I still cannot get rid of the more than 5000 errors on this project. I can run it successfully, but have no idea the reason for so many errors.
One thing I noticed is VS 2015 uses a standard C# project in the solution explorer instead of a special icon indicating a shared project.
How to reproduce the problem:
1 - Download the Modern UI project from github;
2 - Open it on VS 2015;
3 - Make the fix I mentioned here: https://github.com/firstfloorsoftware/mui/issues/48
4 - Reload the shared project after fixing the project file
5 - Notice the number of errors on the error list.
Any ideas?
Igor.
It seems the issue is related to missing files during VS 2015 setup due to the choices I did during setup.
All I did was creating a new Project and choose Windows 8 template. Then the VS 2015 setup is launch and the missing packages are properly installed.
After doing that, I could open my VS 2013 Project in VS 2015 like a charm.
Igor.

One or more project was not loaded properly

After copying the project to another laptop/ PC, when I want to open the solution, VS2010 shows the error "One or more project was not loaded properly". I have tried running visual studio in admin mode but that did not solve the problem.
This is usually a result of an inconsistency in your solution or projects. Open the solution file in an external editor (such as notepad) and check that the path it has to the projects is available and did not change. There shouldn't be any absolute paths in the solution file.
Maybe because the project from where you copied was configured with IIS configurations and you are trying to run the project in visual studio's default environment.
you have to right click on your project and set as a start up project after that you have run your project,
I seem to have found unloaded project, after noticing there's one missing by manually counting and comparing it to the number of projects the solution explorer reported. It was deep inside another folder in the solution explorer that I never used and assumed that had nothing worthwhile.
It's a familiar issue. Looks like the project you are trying to open was created in higher version than what you have. If the project is in MVC, make sure you have installed MVC OR Make sure you have appropriate version of .NET installed in your system.
I work with NopCommerce and a couple of times I downloaded new version and got same error message. It goes away once I install the dependencies.
Because you tagged it ASP.NET make sure you have all the ASP.NET components installed. Those are not part of .net framework but might be necessary in your project.

Categories