MSBuild command won't run from inside Visual Studio

425 views Asked by At

I've been doing a few mods on the open-source MarkdownDeep but I'm having trouble getting a release out - the project includes a post-build task to do some package-ing using Nuget.exe.

I can execute the command without errors from a dos box, but the step always fails (with Error: 9009 when run from VisualStudio as part of a Release build configuration.

Can anyone think why this is?

1

There are 1 answers

0
Grant Thomas On

I would guess that when you are running manually from the command line you are either,

  • executing 'locally', the working directory is that of the required paths used in the build step
  • you are fully qualifying paths appropriately

The bottom line would seem that the path/s do not work out when executed from Visual Studio (can't find directory / file required to perform an operation, due to line-breakage, file not present in the PATH environment variable, and the like).

Pre- and post-build steps in Visual Studio get 'converted' into a single batch script and executed, the paths in this step should be properly enclosed in quotes, absolutely or relatively specified etc. but ultimately need to be able to properly expand/resolve to complete paths.

As an example, I'll quote the following snippet:

SvcUtil.exe parameter1 parameter2 will fail

C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SvcUtil.exe parameter1 parameter2 will fail

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SvcUtil.exe" parameter1 parameter2 will do.