views:

46

answers:

1

I have a simple MSBuild Script that looks like this.

  ...
  <Target Name="CompileSolution">
    <Exec Command="&quot;$(VS90COMNTOOLS)..\IDE\devenv.exe&quot; ..\MyProject.All.sln /build" />
  </Target>
  ...

Now I migrated the propect to Visual Studio 2010 and the command fails.

  ...
  <Target Name="CompileSolution">
    <Exec Command="&quot;$(VS100COMNTOOLS)..\IDE\devenv.exe&quot; ..\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?

+2  A: 

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>
Iain
Doesn't solve the problem but that looks like that's exactly what I want to achive, thanks.
SchlaWiener
the method also allows if you have a big build you can things like the "/m" switch which can runs the build over multiple cores.
Iain