开发者

Need help converting Visual Studio 2008 MSBuild Script to VS2010

开发者 https://www.devze.com 2023-01-22 05:16 出处:网络
I have a simple MSBuild Script that looks like this. ... <Target Name=\"CompileSolution\"> <Exec Command=\"&quot;$(VS90COMNTOOLS)..\\IDE\\devenv.exe&quot; ..\\MyProject.All.sln /buil

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?


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消