VSIX Custom Checkin Policy not loading - tfs

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

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.

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

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.

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.

Will VS2012 work with TFS2010?

I'm considering using VS2012 RC to put together coded UI tests (since VS2010 SP2 FP2 does not fully support IE9).
Currently, my test projects are contained within a solution which is connected to our TFS team project. I also set up a build definition to build the project when new code is checked in (the builds are performed on our build machine).
I suppose that if I upgrade my solution to VS2012, then to be able to build the solution on the build machine I will need VS2012 RC installed there too, right? But then is it possible to specify in my build definition for my project to be built by VS2012 instead of VS2010?
Is it possible for me to upgrade my project with VS2012 while still using TFS2010? I should note my solution will be the only one upgraded to VS2012. All the other solutions in the company still need to be built by VS2010. A company-wide upgrade to VS2012 won't be in place for at least a few months, I imagine.
Or do I need a separate build machine or anything?
Any thoughts, ideas or solutions appreciated!
UPDATE: So I gave it a try, and everything worked okay. My only problem is that the Coded UI tests I have didn't work after being re-built on on my build machine, but I suppose that's probably something I'd need to ask about elsewhere. To clarify, the solution built successfully, but the tests still failed.
Visual Studio 2012's project changes allow most types to still be opened by Visual Studio 2010 with SP1, so it depends on what kind of projects are in your solution - see this page for the full compatibility list:
If you created your assets in Visual Studio 2010 with Service Pack 1
(SP1), many of them will load and run in Visual Studio 2012 without
any further action on your part. Many assets will also open again in
Visual Studio 2010 with SP1 without any issues, even after you open
those assets in Visual Studio 2012.
See also "Round-tripping with Visual Studio 11" on the VS blog which has more detail.
Note though that if your build process uses custom build activities then just installing Visual Studio 2012 breaks the build definition on your local machine, and also that MVC1 or MVC2 projects just aren't supported by VS2012. Oh, and Visual Studio 2012 isn't a RC any more, it was RTM'd last week.
(I presume you mean 2012 RTM rather than RC, now that the final release is available)
Theoretically (from what I've read) VS2012 and VS2010 use the same project/solution file format, so you should be able to switch between them without any compatibility issues (aside, presumably from obvious things like creating new file types that VS2010 doesn't understand)
TFS updates have historically been backwards compatible, so you can usually use different client and server versions (but usually you need a compatibility pack installed for old clients on new servers, a new client running against an old server has usualyl been fine). So I'd expect this to work well.
I'd say try it, but diff any files that appear in VCS2012's Pending Changes carefully before you check in to be sure that it hasn't changed anything that will cause problems. The worst that can happen then is that your development machine gets a "corrupt" version of the code and you'll need to revert to 2010.
(This is the approach I've been using with our 130-project C# solution, and so far (1 day) it's working fine, apart from the new UI making my eyes bleed as they try to find the information in all the indistinguishable monochrome clutter)

Resources