1

I have a very annoying problem. I have installed Visual Studio 2015 Enterprise with Update 3. One important thing to notice, I guess, is that it is not installed on C:\Program Files..., but on D:\Program Files...

I have installed the latest Code Contracts from the Visual Studio Gallery, which is "1.9.10714.2". Still, every time I open Visual Studio, I am seeing a notification that it want's me to update it, since according to it, the version I have installed is "1.8.10107.10". When I click it, it takes me to the same installation file, which says that I have installed that version already and asks me if I want to repair it.

I tried repairing. It didn't help.

I tried uninstalling, deleting folders (Common7\IDE...). It didn't help.

I tried uninstalling visual studio. It didn't help.

Finally I have REINSTALLED windows, along with everything and I still have the same issue.

NOTHING helped.

Please help me!

  • Reinstalling Windows just because some IDE extension has a problem isn't productive. In fact, unnecessary reinstallations *cause* problems rather than fix them. Especially when the problem is a plain-old wrong version number in the `vsix` file and some leftover registry key – Panagiotis Kanavos Aug 12 '16 at 08:50
  • If you google for the version numbers you'll see that it's a known problem and the way to fix it is the 10th comment from the top in the [addin's review page](https://visualstudiogallery.msdn.microsoft.com/1ec7db13-3363-46c9-851f-1ce455f66970). Or you can ignore the warning until a new version comes out – Panagiotis Kanavos Aug 12 '16 at 08:52
  • I have reinstalled because I thought that this causes the Code Contracts to not work correctly. But I guess the problem is elsewhere. Thanks for the info! – Todor Todorov Aug 12 '16 at 08:54
  • Painful experience teaches that reinstallations of IDEs or OSs should be done only if you are 190% certain they are required, ie know the exact issure, reason, workaround and find that it costs more to fix than reinstall. Ignoring a warning doesn't cost anything. Losing settings or files though ... – Panagiotis Kanavos Aug 12 '16 at 08:56

2 Answers2

1

As Panagiotis stated: there is known bug with CodeContracts in VS 2015, that appears is still unfixed. You have to open the extension's manifests and manually change the wrong versions with the correct ones. The extension's manifest files are located in \Microsoft Visual Studio XX.X\Common7\IDE\Extensions\Microsoft\CodeContracts\1.9.10714.2 where XX.X is VS version. On my machine (VS 2015 + SQL 2014 + SSDT) there were 11.0, 12.0 and 14.0 folders and there were manifests in each one of them. Only one of them was wrong, so I fixed just one file. You can open the manifests with Notepad or any other XML editor, they are XML files.

Correct manifest looks like this:

<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
    <Metadata>
        <Identity Version="1.9.10714.2" Id="CodeContractsVSIX.MicrosoftResearch.990ACB05-1AAE-4fa6-A178-9BF28206012F" Language="en" Publisher="Microsoft Research" />
        <DisplayName>Code Contracts Tools</DisplayName>
    [...]
    </Metadata>
[...]
</PackageManifest>
0

As per my answer here, I have installed CodeContracts v.1.10.10126.2-rc1 and it is working (and stable) with Visual Studio 2015.

This version of CodeContracts is the first major community-driven release of the DotNet CodeContracts, and resolves the problem you describe (and many other issues too!)

NuGet package is located here: https://www.nuget.org/packages/DotNet.Contracts/1.10.10126.4

Community
  • 1
  • 1
Ɖiamond ǤeezeƦ
  • 3,223
  • 3
  • 28
  • 40