Update 2 Error Adding MVC View - asp.net-mvc

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

Related

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.

After applying update 2 VisualStudio 2015 Enterprise can't connect to TFS - exception TF205020

VisualStudio 2015.1 Enterprise/TFS integration worked fine until VS2015 update 2 was applied.
Reinstalling/repairing VisualStudio didn't fix the issue, keep getting:
TF205020: Could not connect to server ...... The server returned the following error:
Could not load type Microsoft.VisualStudio.Services.WebApi.Utilities.UserAgentUtility' from assembly 'Microsoft.VisualStudio.Services.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
SETUP:
VS Enterprise 2015.2
TFS 2015.2
We had the same issue here. Reinstalling Visual Studio 2015 after deleting cache, user profile folders and registry settings didn't help us. It looks like a TestComplete 11.31 installation installs some assemblies in the GAC which conflicts with Visual Studio 2015 Update 2. We fixed the issue comparing two almost identical systems (one with and one without TestComplete) and these assemblies we deleted from the %WINDOWS%\Microsoft.NET\assembly folder:
Micorosft.VisualStudio.Services.Client
Micorosft.VisualStudio.Services.Common
Micorosft.VisualStudio.Services.Integration
Micorosft.VisualStudio.Services.WebApi
But the problem still existed. After removing:
Microsoft.TeamFoundation.Client
Microsoft.TeamFoundation.WorkItemTracking.Common
the problem was gone!
I hope this will help your issue...
To narrow down this issue:
Check Windows event viewer for more info of the errors.
Try to clear TFS and VS cache ,detail step with this blog
Try to make sure you can access the TFS web
accesshttp://:8080/tfs/web/
The same as this issue: Extension fails to load on VS2015.2, try with the solution in it:
Can you check if Microsoft.VisualStudio.Services.WebApi.dll is
installed into the GAC? The easiest way to do this is to check if
there is a folder that starts with v14.0.0.0 under the
c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Services.WebApi.
I suspect you have an assembly from VS 2015 RTM or VS 2015 Update 1 in
the GAC. Uninstalling it, will fix the issue.
Thanks to Ernstjan Freriks, this additional info (originally from Microsoft Connect) helped me:
The Tfs client binaries should not be in your GAC. The only way they would get there is to add them yourself, or install some 3rd party application that has added them. Once they are in the GAC they will be loaded instead of the binary that matches your version of TeamExplorer or tf.exe. You need to remove all instances of any Team Foundation binary from the GAC including the following:
Microsoft.TeamFoundation.Build2.WebApi.dll
Microsoft.TeamFoundation.Chat.WebApi.dll
Microsoft.TeamFoundation.Common.dll
Microsoft.TeamFoundation.Core.WebApi.dll
Microsoft.TeamFoundation.Diff.dll
Microsoft.TeamFoundation.Discussion.Client.dll
Microsoft.TeamFoundation.Discussion.WebApi.dll
Microsoft.TeamFoundation.Git.Client.dll
Microsoft.TeamFoundation.Lab.Client.dll
Microsoft.TeamFoundation.Lab.Common.dll
Microsoft.TeamFoundation.Lab.TestIntegration.Client.dll
Microsoft.TeamFoundation.Lab.WorkflowIntegration.Client.dll
Microsoft.TeamFoundation.Policy.WebApi.dll
Microsoft.TeamFoundation.ProjectManagement.dll
Microsoft.TeamFoundation.SharePointReporting.Integration.dll
Microsoft.TeamFoundation.SourceControl.WebApi.dll
Microsoft.TeamFoundation.Test.WebApi.dll
Microsoft.TeamFoundation.TestImpact.Client.dll
Microsoft.TeamFoundation.TestManagement.Client.dll
Microsoft.TeamFoundation.TestManagement.Common.dll
Microsoft.TeamFoundation.TestManagement.WebApi.dll
Microsoft.TeamFoundation.VersionControl.Client.dll
Microsoft.TeamFoundation.VersionControl.Common.dll
Microsoft.TeamFoundation.VersionControl.Common.Integration.dll
Microsoft.TeamFoundation.Work.WebApi.dll
Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll
Microsoft.TeamFoundation.WorkItemTracking.Client.dll
Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.dll
Microsoft.TeamFoundation.WorkItemTracking.Common.dll
Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll
Microsoft.TeamFoundation.WorkItemTracking.WebApi.dll
Microsoft.VisualStudio.Services.Client.dll
Microsoft.VisualStudio.Services.Common.dll
Microsoft.VisualStudio.Services.WebApi.dll
You can use gacutil to remove these. Once removed your issue should be fixed.

Visual Studio 2015 Crashing when opening old razor views

I've been trying to install VS 2015 Enterprise edition on my computer but keep running into an issue. Hunting through SO for the last 24 hours, I've already tried the devenv.exe /ResetUserData & clearing the VS cache fixes, uninstalling enterprise edition and installing professional edition (which still failed for the same reason) and then reinstalling enterprise edition. I've tried deleting the .vs folder before opening the solution, ensuring that the MVC versions in the /Views/ web.config matches the version of the sites web.config (MVC 5.2.3.0).
As of this morning, I've noticed that it only crashes when I try to open a razor view that wasn't created through Visual Studio 2015 (I was using VS 2012 previously, and I'm trying to work on this project in 2015 now that I have a license). I can right-click in the solution explorer to create a brand new view and write anything I want in it with intellisense and save it, and open it back up without any issues.
I get the whole "An exception has occurred, this may be caused by an extension" message and then visual studio restarts if I try to open up a view that was already created through VS 2012.
I've tried looking inside of the log that it provides but I'm a newer developer so I can't really deduce anything from it..I'll attach it if anyone else can make anything of it.
MS VS Enterprise 2015 - Version 14.0.25029.00 Update 2 RC - .NET Framework Version 4.6.01055
I just cleared out the ActivityLog.XML and forced the error to get a fresh set of details - http://pastebin.com/j7RbGJFP
I found the answer in this blog post - https://blogs.msdn.microsoft.com/webdev/2016/01/12/visual-studio-keeps-showing-suggested-extensions/. It has to do with the extensions suggestion - it turns out if you have files not included in your project, you can't view them because of a bug introduced through the extensions suggestion. If you turn that off and include the views in the project, VS won't crash and you'll have intellisense.

this template attempted to load component assembly Microsoft.VisualStudio.Web.Project

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 !

VSIX Custom Checkin Policy not loading

I'm attempting to modify a custom Checkin Policy to work against Visual Studio 2013.
At first, I attempted to just add a new section to the manifest for 2013:
<VisualStudio Version="12.0">
<Edition>Ultimate</Edition>
<Edition>Premium</Edition>
<Edition>Pro</Edition>
</VisualStudio>
and whilst this allowed it to install, it doesn't allow the policy to run (if I go to the policies>>Add section of TFS it's not present, and the policies throws an exception stating that the Policy is not registered).
After much hunting around, I thought perhaps there was an issue with the Policies.pkgdef - The Extension manager in VS2013 shows it as installed, but it's not showing as installed at Pending Changes. However I can't see any issue with it either:
[$RootKey$\TeamFoundation\SourceControl\Checkin Policies]
"VersionOneTFSPolicy"="$PackageFolder$\VersionOneTFSPolicy.dll"
I've opened it and compiled it in 2013, and fixed any reference issues so that it will compile correctly, but it still doesn't seem to like using it.
Does VS2013 manage Custom Checkin policies differently to 2010/2012? From what I can see it should just work with a manifest change and a recompile.
Edit
So I managed to get the custom policy running on VS2013 by upgrading the reference to Microsoft.TeamFoundation.VersionControl.Client from 11 to 12 and upgrading the project to .Net 4.5. However, this now renders the custom policy unusable on VS2012 (and I would assume 2010 too but I haven't tested that yet). Is there a way to have this run on 2010 through to 2013 from a single VSIX?
In the absence of any other solution, I reverted to the tried and tested method of updating the extension and building it as a new package. So simply having a 2012 version and a completely separate 2013 version.
I am trying to solve this as well, and from everything I have found, the only way to get extensions that target all versions is to actually create 3 separate (2010, 2012 and 2013) extensions, and install them using an InstallShield package that has each one as sub-features that get installed in sequence.
Upgrades are then done on each one individually as the VSIX is actually doing the install.
Links that may help you out on this include:
Single extension targeting VS 2012 and VS 2013
How to target an extension in both VS2012 and VS2010

Resources