I have a simple MSBuild Script that looks like this.
...
<Target Name="CompileSolution">
<Exec Command=""$(VS90COMNTOOLS)..\IDE\devenv.exe" ..\MyProject.All.sln /build" />
</Target>
...
Now I migrated the propect to Visual Studio 2010 and the command fails.
...
<Target Name="CompileSolution">
<Exec Command=""$(VS100COMNTOOLS)..\IDE\devenv.exe" ..\MyProject.All.sln /build" />
</Target>
...
because the variable $(VS100COMNTOOLS)
is empty. I verified that with
<Exec Command="echo $(VS100COMNTOOLS)" />
and I checked that the environment variable "VS100COMNTOOLS" exists. If I modify the command to use the full path to devenv.exe
rather than the variable, everything works fine. But that's just a temporary solution since the devenv path differs for my collegues.
What is the best way to query 开发者_开发百科the VS100COMNTOOLS
path in a Visual Studio 2010 MSBuild Script?
I don't know if this is any use, but instead of using visual studion to build you can just use an msbuild itself, here any example:
<PropertyGroup>
<Configuration>Release</Configuration>
</PropertyGroup>
<Target Name="CoreBuild">
<Message text="Core Build"/>
<MSBuild Projects ="@(ProjectsToBuild)"
ContinueOnError ="false"
Properties="Configuration=$(Configuration)" >
<Output ItemName="OutputFiles" TaskParameter="TargetOutputs"/>
</MSBuild>
</Target>
<ItemGroup>
<ProjectsToBuild Include="**\*sln" Exclude="$(MSBuildProjectFile)"/>
</ItemGroup>
精彩评论