Bernard
Bernard

Reputation: 2043

Calling devenv.exe for multiple .vdproj files

I have a solution that has multiple vdproj files in it. I have created an item group in my build.proj file:

<ItemGroup>
<SetupProjectFiles Include="$(MSBuildProjectDirectory\**\*.vdproj">
</SetupProjectFiles>

Now I want to call devenv.exe on each of those?

<Exec Command="devenv.exe %(SetupProjectFiles)"></Exec>

Doesn't work...anyone have any pointers please?

Upvotes: 1

Views: 1236

Answers (1)

Michael
Michael

Reputation: 1282

There are a few things worth double-checking. Check through this list and see the code snippet below for a working example.

  1. Make sure the paths to vdproj files are correct. Try writing a message to the log for each file path, so you can verify which vdproj files are included.

  2. Make sure the vdproj is included in the desired build configuration for the solution; if you are building a "Debug" configuration, make sure the vdproj is checked in the solution's build Configuration Manager for the "Debug" config combination(s). You can set this globally or set it for each vdproj specified in the metadata of each SetupProjectFiles item (see snippet below for example of this).

  3. Make sure to use the full devenv.exe path. You can use an environment variable to help out with this.

  4. Make sure the MSBuild Exec task syntax and devenv.exe syntax are correct, e.g., using the /build switch and using &quot; around paths with space characters.


EDIT: Corrected typos in code


<ItemGroup>
  <SetupProjectFiles Include="$(MSBuildProjectDirectory)\**\*.vdproj">
    <Configuration>Release</Configuration>
  </SetupProjectFiles>
</ItemGroup>

<PropertyGroup>
  <!-- VS110COMNTOOLS is for VS2012. VS100COMNTOOLS is for VS 2010. VS90COMNTOOLS is for VS2008 -->
  <DevEnvLocation>$(VS100COMNTOOLS)..\IDE\devenv.exe</DevEnvLocation>
</PropertyGroup>

<Message Text="vdproj file:  %(SetupProjectFiles.FullPath)" />

<Exec Command="&quot;$(DevEnvLocation)&quot; &quot;%(SetupProjectFiles.FullPath)&quot; /build &quot;%(SetupProjectFiles.Configuration)&quot;" />

Upvotes: 5

Related Questions