I need to execute the following Windows Azure SDK tool using the Exec
task:
C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\v2.3\bin\cspack.exe
What is the best way to reference this path in my .build
file?
A direct reference, like below, it likely not to work on all hosts (build servers and development machines):
<Target Name="CreatePackage" DependsOnTargets="Build" AfterTargets="Build">
<Exec Command="C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\v2.2\bin\cspack.exe /parameters"></Exec>
</Target>
(Note: I do not want to use the CSPack task)
My rule of thumb is to either use ToolLocationHelper
class, or a registry property $(registry:Hive\Foo)
, or fire up something like Rapid Environment Editor and choose a variable that would give me the shortest, most fault-tolerant path. In this case you don't have much of a choice, the best you can do is to have an item Include="$(ProgramW6432)\Microsoft SDKs\Windows Azure\.NET SDK\**\bin\cspack.exe"
that would protect against different architectures, non-default paths and versions, or if it's part of a bigger script run setenv.cmd
first and use $(ServiceHostingSDKInstallPath)
. You can also try running msbuild foo.build /v:diag > foo.txt
and look through the evaluated properties dump, but the various SDK paths would depend on if you're running x86 or x64 MSBuild and would be developer specific.