this template attempted to load component assembly Microsoft.VisualStudio.Web.Project - asp.net-mvc

I just installed Visual Studio 2013 Ultimate trial version for completing the MVC5 tutorial by Rick Anderson, which worht doing it.
The tutorial: http://www.asp.net/mvc/tutorials/mvc-5/introduction/getting-started.
However, I created a blank solution first and then try to add an ASP.Net Application project, which is going to be my MVC5 tutorial project. And I got this weird message:
Error: this template attempted to load component assembly
'Microsoft.VisualStudio.Web.Project, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'. For more information on this problem
and how to enable this template, please see documentation on
Customizing Project Templates.
But I´m not customizing, I´m just creating a project out of a built in template.
Do you know how can I solve it?

Here is the solution:
In Visual Studio 2013, select Tools > Extensions and Updates
Check for updates. You should have the Azure SDK update available.
Download and install the Azure SDK. After this, everything should work fine.
If your updates are not turned on, enable your auto detection of updates in Tools > Options > Environment > Extensions.
If you have unspecified error related to E_fail(code), try this:
When creating a new MVC 5 application, change the framework version from 4.5.1 to 4.5, if that did not work change it to 4. Check the below image if it is not clear.
Another approach:
This is really important if you are installing Visual Studio 2013 on un-updated Windows 7.
there reason i am calling out "not updated is",
The reason that 'un-updated' matters is because Visual studio 2013 does not update the powershell that is required by VS2013 for most of the stuff.
The simple solution is to update Powershell to the latest version.
If you are not sure how to update powershell, you can use this tutorial.

So I stumbled upon this issue as well and would like to share how I was able to resolve this problem.
Tools -> Extensions and Updates -> Online -> NGet Package Manager: Click the download button once you have the NGet Package Manager selected. Make sure to restart your Visual Studio after you have downloaded the Manager.
This should do the trick

Close Visual Studio, run the VS executable with the command line option as shown below (you will likely have to supply the full path), and relaunch VS normally. This should re-initialize the templates, including the one that you are having problems with.
devenv.exe /installvstemplates

So I faced the same problem with Visual Studio 2013, and I don't know what's the problem but it appears that it only occurs when creating a new project, and choosing "Web" from the panel.
What I did was simply clicking on "Visual Studio 2012" just below it, and it worked !

Related

model does not exist in the current context in view after opening project in visual studio 2017

My project was working in visual studio 2012 MVC4 i opened it in visual studio 2017 and i see under URL,model,View Bag,im getting error stating model does not exist,Url does not exist in the current context,
i dont know what im missing something which i have to add when i want to open project in visual studio 2017,in webconfig my mvc version :
System.Web.Mvc, Version=3.0.0.0
i changed it to 4 also but still the same errors,what could be the cause?am i missing a reference?
Are you able to run the project, even though it's giving you errors? I had the same issue when I started using VS2017 with an older project. For some reason, it could not resolve the dependencies and restore packages was not working. However, I am now on VS2017 15.8.6, and a simple "Rebuild Solution" did the trick. Failing that, you can try some of the suggestions mentioned here. Good luck, I hope it helps!

My VSIX extension is not showing on VS2017 (Was on 2015)

I have a VSIX extension (https://github.com/eduelias/AssociateRecentWorkItems) that worked really well on my VS2015 but, as I built/run it on VS2017 (yeah, I've put the prerequisites on the .csproj properties), it is not appearing at 2017's TFS Pending Changes tab.
I've tried updating MIcrosoft.TeamfoundationServer.Controls to the 2017 version but still no success.
As I try to debug it, it seems that VS2017 isn't loading the extension at all. (Breakpoints aren't not been loaded)
Any help is welcome. Thanks!
Give a try with another new extension on VS2017(from marketplace) in your side. If this could also not installed successfully and you are using VS2017 RC.
You may encountered this issue--Unable to install extensions after updating VS2017 RC
Either update to latest VS version or use Stefan Z Camilleri 's workaround in above link.
If only your old extension could not be installed, since
Huge changes have been made by Microsoft on the installation, so
previous approaches of detecting VS won't work any more. For example,
to detect VS installation folder, now a few extra tools or scripts are
required, https://github.com/Microsoft/vswhere
So guides such as How to: Migrate Extensibility Projects to Visual
Studio
2017
are critical and you can follow the tips.
You could also refer more details in this similar question Visual Studio 2017 is not detected by extensions for installation
Looking through the log, I was able to find that some of my references were asking for Microsoft.TeamFoundation.Client Version=14.0.0, in fact, It was the Microsoft.TeamFoundation.VersionControl version=12.0 that were looking for it.
To solve it, I've made a 'binding redirect' like this:
[assembly: ProvideBindingRedirection(AssemblyName = "Microsoft.TeamFoundation.Client", NewVersion = "15.0.0.0", OldVersionLowerBound = "12.0.0.0", OldVersionUpperBound = "14.0.0.0")]
It started appearing at the Exp instance and I was able to debug it.
Note that I strongly advise against doing such kind of workaround but, in my case, it was the only way I could make it load my extension so I could debug it.

Visual Studio for Mac- Error CS1902

I just recently swapped my MS PC for an Mac, I'm trying to continue working on an MVC project, but I'm getting an error (Error CS1902: Invalid option 'portable' for /debug; must be full or pdbonly (CS1902)).
Are there any good documents that explain how to make it work? I have seen people porting MVC to .NET Core, but I can't get the analyser to work on my Mac (not sure it's supported yet).
I did two things.
I update the Microsoft.Net.Compliers via nuget.
https://www.nuget.org/packages/Microsoft.Net.Compilers/
Change one value in the properties of project.
https://johnharold.wordpress.com/2017/08/16/csc-error-cs1902-invalid-option-portable-for-debug-must-be-full-or-pdbonly-cs1902/
I wish you can solve the problem
I had this same problem when trying to use Visual Studio for Mac to build a solution that works fine in Windows. Turns out the /debug:portable flag was being passed to the build command, even though the 'Debug Information' was correctly set to 'Full' in my project settings. Search the build output for 'portable' and you will indeed find the flag there regardless of your settings.
The fix is to upgrade the Microsoft.Net.Compilers nuget package. In my case, it upgraded from 1.0 to 2.7, and then the project built successfully.
Right click on the project in the solution explorer and go to
Options, Build, Compiler and change Debug information to Full

Update 2 Error Adding MVC View

Last night, I updated Visual Studio 2015 on my system from RTM to Update 2. I now get an error message when I try to add a new View to an ASP.Net MVC application I am working on:
There was an error running the selected code generator:
'Expected 1 export(s) with contract name "NuGet.VisualStudio.IVs.PackageInstaller" but found 0 after applying applicable constraints.'
Any ideas on how to fix this? I had no trouble adding a few views to this project yesterday before I installed the update.
tl;dr - Reinstall NuGet Package Manager
I know this is an old thread. But I encounter the same error message today and found no solution online that works for me. So I decided to answer on this old thread for future devs that will encounter the same error message.
The reason for my case is that my NuGet Package Manager was missing.
I recently installed Wekan and it required me to install Visual C++ 2015 Build Tools, and I think that might be the culprit why NuGet was removed.
So, my solution is to download and reinstall NuGet Package Manager:
In Visual Studio open Extensions and Updates Tools > Extensions and Updates (or by pressing ALT+T+U)
On the left pane click Online and search for keyword NuGet Package Manager for Visual Studio 2015, download/install
Restart VS
These are the other solution that worked for some (didn't work for me):
Try clearing the ComponentModelCache, the cache will rebuild next time VS is launched.
Delete NuGet.Config at C:\Users\UserName\AppData\Roaming\NuGet, and restart VS
Unload/Reload project, Clean solution, Rebuild then restart VS
Updating the VS2015 will force you to update after that the whole work you have done so far. Most of the references specially NuGet are changed or outdated in 2015. I am currently using vs2013 with MVC5. I would suggest you to update the references and find a solution about this NuGet package. It might be no longer available for this view you want to add. In addition, there is a similar topic with Q&A to your and it is accessible right here: Unable to Install Any Package in Visual Studio 2015 . Take a look but VS2015 the free version is not that good for coding. Better download visual studio 2013 with update 5 and you will be much better. If you still want to keep it with VS2015, take a look at this and download it.
VS2015 NuGet Manager:
https://visualstudiogallery.msdn.microsoft.com/5d345edc-2e2d-4a9c-b73b-d53956dc458d

MvcSiteMapProvider.dll not working in Visual Studio 2013

I have a MVC 2 project created in Visual Studio 2010 that use MvcSiteMapProvider.dll and works fine. But when loading the project in Visual Studio 2013, everything else work fine except it crashes at
Html.MvcSiteMap().SiteMapPath
The error message is
An exception of type 'MvcSiteMapProvider.MvcSiteMapException' occurred in MvcSiteMapProvider.dll but was not handled in user code
I believe that MvcSiteMapProvider.dll cannot be loaded correctly. I need help on this. Thanks.
Note that there is a separate DLL for each .NET framework version, and I suspect you are targeting the wrong framework. This can happen if you install MvcSiteMapProvider into your project and then change it to a different .NET framework version.
NuGet does not automatically upgrade/downgrade packages to the currently set framework version. This step must be done manually. The best way is to completely uninstall and reinstall the package as per this document. Also be sure to read this before attempting it.
But do note that if you do this NuGet will not remove any files you have changed (like Mvc.sitemap) and then prompt you whether to overwrite them. You should normally say no to each prompt to ensure your custom configuration is not overwritten.
Also note that it is not sufficient to use Assembly Binding Redirection with MvcSiteMapProvider because with each .NET framework version we create a separate build (DLL) that takes advantage of features that are not present in prior versions.

Resources