views:

302

answers:

2

I'm trying to perform the following post build step in a VS2008 project:

sn.exe **some arguments**

And keep on getting the error

'sn.exe' is not recognized as an internal or external command, operable program or batch file.

What path / environment variables are used when executing the post build steps? I had assumed that it was equivalent to the environment created by the visual studio command prompt, however apparently this isnt the case.

What would be the best way of making sure that I can use common build tools (such as sn.exe)

+1  A: 

Specify the full path to sn.exe in the command.

eg, c:\winsdk\bin\sn.exe

This works if you have the Windows SDK installed at c:\winsdk. If you have the Windows SDK installed at the traditional spot, then you might use

"c:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\sn.exe"

Be sure to use double-quotes around that path, because it includes spaces, and check/replace that version number.

I used the junction.exe tool to define a junction at c:\winsdk, referring to "c:\Program Files\Microsoft SDKs\Windows\v6.1", which allows me to use either form.

Cheeso
I really want to avoid specifying exact paths - this project file is built on a number of different machines including build machines and developer machines - some of them x64, some of them x86, some of them xp some of them Windows 7 etc... With an explicit path like that the build breaks even if the developer installs the SDK in a slightly different location (or installs a different version of the SDK)
Kragen
@Kragen: A way out of this would be to use an environment variable (`%SNPATH%`) that all machines must define. There's also pre-defined variables for different VS installations (e.g. `%VS90COMNTOOLS%`).
sbi
@Kragen - You'll have to establish some convention for how to find the location of sn.exe, then. Either an environment variable as suggested by @sbi, or a well-known install location for the Windows SDK.
Cheeso
+1  A: 

You might try running vcvarsall.bat to set environment variables.

Guy