Building unit test project with Fakes fails with error exit code 9009 - by pratik khasnabis

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 751873 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 6/30/2012 5:01:21 AM
Access Restriction Public


The build fails with error

Error	2	The command ""C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin\sn.exe" /R "o\mscorlib." "f.snk"" exited with code 9009. [E:\Visual Studio 2010\ClassLibrary1\UnitTestProject1\obj\Debug\Fakes\m\f.csproj]	C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets	269	5	UnitTestProject1

It seems that the path for the sn.exe tool is not correct
"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin\sn.exe"
In my machine the sn.exe is in
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin\NETFX 4.0 Tools
Sign in to post a comment.
Posted by Patrick [MSFT] on 9/14/2012 at 8:50 AM
Deal all,
Previous post (from Mike) indicated that this is a bug which we finally are able to repro. Thankfully, the fix is already in the lastest CodeContract bits. You can download via

Patrick Tseng
Visual Studio team.
Posted by Mike Barnett on 9/13/2012 at 7:45 AM
We (the Code Contracts team) had inadvertantly caused this problem with an incorrect targets file. If you install the newest version of Code Contracts for .NET, then the problem should go away. Sorry!
Posted by MichaelChristian on 9/4/2012 at 2:05 PM
It seems the path "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\" is targeting Windows 8? The path "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\" contains the proper files. Is there some means of changing which path is sent to the compiler?
Posted by Dmitry DZ Antonov on 8/17/2012 at 8:09 AM
The same bug in RTM!
Posted by Patrick [MSFT] on 8/3/2012 at 12:04 PM
Minor typo, the combinations are:
    VS2010 + VS2012-Beta
    VS2010 + VS2012-RC
    VS2010 + VS2012-RTM

on 64 bit VM.
Posted by Patrick [MSFT] on 8/3/2012 at 12:01 PM
Hi Pratikk1,

I have also tried on the side by side scenario (i.e. VS2010 and VS2012 Beta ) and I cannot repro. As of now, I have tried the following combinations.
    VS2012 + VS2012-Beta
    VS2012 + VS2012-RC
    VS2012 + VS2012-RTM

and I cannot repro them. Since RTM is going out in the very near future, please retry your combination and let us know if you still encountering issues.


Posted by pratik khasnabis on 8/1/2012 at 7:38 PM
You are correct that sn.exe is not in C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin
This is not the issue. The issue is that the msbuild system is expecting sn.exe to be in that location instead of in C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools and this is the real issue.
Posted by Patrick [MSFT] on 8/1/2012 at 8:17 AM
Hi Pratikk1,

I just tried the following installation.

1. Install VS2010 Ultimate in a clean box. sn.exe reside in the following folders
    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
        3/18/2010 07:51 PM            95,552 sn.exe
    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools
        3/18/2010 07:51 PM         168,768 sn.exe
    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64
        3/19/2010 06:16 AM         187,712 sn.exe
    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64
        3/19/2010 06:16 AM         102,208 sn.exe

2. Install VS2012 Ultimate RC (not *beta* in your case) in the same box. new sn.exe is additionally installed in the following
    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools
        04/30/2012 06:28 PM         228,200 sn.exe
    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64
        04/30/2012 05:21 PM         251,232 sn.exe
3. I tried your project and I cannot repro. I did not see sn.exe on C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin

I am going to try the following combination
1. Install 2010 VS Ultimate
2. Install 2012 Beta

Stay tuned.
Posted by pratik khasnabis on 7/30/2012 at 6:36 PM
1. Yes Visual Studio 2010 Ultimate is installed in this box
2. I don't know what you mean by this. It is a used Wndows 7 64bit machine with VS 2010 already installed. I installed the VS 2012 Beta in this and the installation was successful.
3. In this machine sn.exe is in C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools folder. So the folder where sn.exe is actually installed according to you is correct. But the VS build is expecting this to be in C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin\sn.exe which is not correct.

I have tried this in another desktop and I had the same issue. I tried this in my personal laptop and there was no issue. So it seems in atleast some machines there is an issue.
Posted by Patrick [MSFT] on 7/30/2012 at 8:34 AM
Dear pratikk1,

I have tried your solution on RCRel50522 branch as well as RTM branch. I cannot repro this issue. I am wondering whether this is machine setup issue. A few thoughts.

1. Do you have VS2010 installed in the same box ?
2. Is this a clean install ?
3. Would it be possible to try on another box ? On 64 bit machine, SN.exe should be in "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin\NETFX 4.0 Tools" folder. Not on "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin".

Patrick Tseng
Visual Studio team

Posted by pratik khasnabis on 7/23/2012 at 6:14 PM
I have attached the sample solution that has this problem.
Posted by Patrick [MSFT] on 7/20/2012 at 3:43 PM
Dear pratikk1,

We have tried a few x64 machines and cannot repro. Is it possible for you to send over your project? Please pair down your code to the bare-bone so we don't accidentally reveal any IP.

Patrick Tseng
Visual Studio team
Posted by achurch1 on 7/13/2012 at 8:48 AM
My path is also C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\sn.exe
Posted by achurch1 on 7/13/2012 at 8:47 AM
C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets(244,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bin\sn.exe" /R "o\System.Web." "f.snk"" exited with code 9009.
Posted by achurch1 on 7/13/2012 at 8:43 AM
I'm experiencing the same issue after trying to create a Fakes assembly for System.Web
Posted by Microsoft on 7/1/2012 at 9:26 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 6/30/2012 at 5:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(