Note that there are some explanatory texts on larger screens.

plurals
  1. POUse a single Visual Studio solution to build both x86 and x64 at the same time?
    text
    copied!<p>I've got an x86 Visual Studio solution with many project files in it. Some of the DLLs are designed to work as plug-ins to other applications on a user's system. We're expanding some of the DLLs to be able to support 64-bit applications. What I'd like to do is setup the solution/projects so that just hitting "Build" will build both the x86 and x64 versions of those DLLs. The solution contains both C++ and C# projects. I realize that "Batch Build" is capable of building both, though it would be more convenient if developers could just click the same button as they have previously and have all of the output DLLs generated.</p> <p>Here's a couple of the modifications that I've tried to a test project, but haven't gotten to work:</p> <p>I've tried modifying the <code>&lt;Target Name="AfterBuild"&gt;</code> to try:</p> <pre><code>&lt;Target Name="AfterBuild" Condition=" '$(Platform)' == 'x86' "&gt; &lt;PropertyGroup&gt; &lt;Platform&gt;x64&lt;/Platform&gt; &lt;PlatformTarget&gt;x64&lt;/PlatformTarget&gt; &lt;/PropertyGroup&gt; &lt;CallTarget Targets="Build"/&gt; &lt;/Target&gt; </code></pre> <p>but that results in the following error:</p> <pre>C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(565,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "Build".</pre> <p>I think my conditions will prevent infinite recursion, but I understand how MSBuild could not see it that way.</p> <p>I've also tried:</p> <pre><code>&lt;Project DefaultTargets="MyBuild86;MyBuild64" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"&gt; ... &lt;Target Name="MyBuild86"&gt; &lt;PropertyGroup&gt; &lt;Platform&gt;x86&lt;/Platform&gt; &lt;PlatformTarget&gt;x86&lt;/PlatformTarget&gt; &lt;/PropertyGroup&gt; &lt;CallTarget Targets="Build"/&gt; &lt;/Target&gt; &lt;Target Name="MyBuild64"&gt; &lt;PropertyGroup&gt; &lt;Platform&gt;x64&lt;/Platform&gt; &lt;PlatformTarget&gt;x64&lt;/PlatformTarget&gt; &lt;/PropertyGroup&gt; &lt;CallTarget Targets="Build"/&gt; &lt;/Target&gt; </code></pre> <p>but my <code>DefaultTargets</code> appears to be ignored from within the Visual Studio IDE.</p> <p>Last, I've tried creating a separate project that imports the first project:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; &lt;PropertyGroup&gt; &lt;Configuration Condition=" '$(Configuration)' == '' "&gt;Debug&lt;/Configuration&gt; &lt;Platform&gt;x64&lt;/Platform&gt; &lt;PlatformTarget&gt;x64&lt;/PlatformTarget&gt; &lt;ProductVersion&gt;9.0.30729&lt;/ProductVersion&gt; &lt;SchemaVersion&gt;2.0&lt;/SchemaVersion&gt; &lt;OutputPath&gt;..\$(Configuration)\x64\&lt;/OutputPath&gt; &lt;ProjectGuid&gt;{A885CAC3-2BBE-4808-B470-5B8D482CFF0A}&lt;/ProjectGuid&gt; &lt;/PropertyGroup&gt; &lt;Import Project="BuildTest.csproj" /&gt; &lt;/Project&gt; </code></pre> <p>and this so far has shown the most promise. However, Visual Studio seems to ignore my <code>OutputPath</code> setting from this new project and instead outputs the exe/dll to the path specified in the original project. There's no <code>PropertyGroup</code> block that I can see that is being executed in the original project to override this, so I'm not sure what's happening.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload