Code Contracts compile error

mail's Avatar


05 Oct, 2015 08:30 AM

Hi everyone,

In my project I have a compile error which cannot be resolved, because the build tools are broken.
Please have a look at this article:
Can you either fix this problem or update code contracts on the build server?

My project in question can be found here:

Thank you and best regards

  1. Support Staff 1 Posted by Feodor Fitsner on 05 Oct, 2015 05:05 PM

    Feodor Fitsner's Avatar

    Hi Rico,

    As a workaround you can just add this simple PS script to your build:

    $p = 'C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v14.0\Microsoft.CodeContracts.targets'
    $c = [IO.File]::ReadAllText($p)
    $c = $c.Replace('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.6 Tools\sn.exe', '$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\sn.exe')
    [IO.File]::WriteAllText($p, $c)

    At the moment the latest version of code contracts is already installed on build workers:

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:00 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac