tag:help.appveyor.com,2012-11-13:/discussions/problems/3201-code-contracts-compile-errorAppVeyor: Discussion 2018-09-28T16:19:30Ztag:help.appveyor.com,2012-11-13:Comment/381033132015-10-05T08:30:51Z2018-09-28T16:19:30ZCode Contracts compile error<div><p>Hi everyone,</p>
<p>In my project I have a compile error which cannot be resolved, because the build tools are broken.<br>
Please have a look at this article: <a href="http://blog.rsuter.com/code-contracts-compile-error-in-visual-studio-2015-and-windows-10/">http://blog.rsuter.com/code-contracts-compile-error-in-visual-studi...</a><br>
Can you either fix this problem or update code contracts on the build server?</p>
<p>My project in question can be found here: <a href="https://ci.appveyor.com/project/rsuter/mytoolkit">https://ci.appveyor.com/project/rsuter/mytoolkit</a></p>
<p>Thank you and best regards<br>
Rico</p></div>mailtag:help.appveyor.com,2012-11-13:Comment/381033132015-10-05T17:05:11Z2015-10-05T17:05:11ZCode Contracts compile error<div><p>Hi Rico,</p>
<p>As a workaround you can just add this simple PS script to your
build:</p>
<pre>
<code>$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)</code>
</pre>
<p>At the moment the latest version of code contracts is already
installed on build workers: <a href="https://visualstudiogallery.msdn.microsoft.com/1ec7db13-3363-46c9-851f-1ce455f66970">
https://visualstudiogallery.msdn.microsoft.com/1ec7db13-3363-46c9-8...</a></p></div>Feodor Fitsner