Use a single Visual Studio solution to build both x86 and x64 at the same time?

We do something similar to build core assemblies for . NET CF. Try this.

Up vote 6 down vote favorite 2 share g+ share fb share tw.

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.

Here's a couple of the modifications that I've tried to a test project, but haven't gotten to work: I've tried modifying the to try: x64 x64 but that results in the following error: 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".

I think my conditions will prevent infinite recursion, but I understand how MSBuild could not see it that way. I've also tried: ... x86 x86 x64 x64 but my DefaultTargets appears to be ignored from within the Visual Studio IDE. Last, I've tried creating a separate project that imports the first project: Debug x64 x64 9.0.30729 2.0 ..\$(Configuration)\x64\ {A885CAC3-2BBE-4808-B470-5B8D482CFF0A} and this so far has shown the most promise.

However, Visual Studio seems to ignore my OutputPath setting from this new project and instead outputs the exe/dll to the path specified in the original project. There's no PropertyGroup block that I can see that is being executed in the original project to override this, so I'm not sure what's happening. Visual-studio visual-studio-2008 msbuild x64 link|improve this question edited Oct 16 '09 at 14:39 asked Oct 15 '09 at 18:04PeteVasi116311 88% accept rate.

Seems to work quite well, thanks. Now to figure out something similar for the C++ projects... – PeteVasi Oct 20 '09 at 13:31.

I think the best way of doing this is to invoke msbuild from the command line. It shouldn't need editing of msbuild files, just run msbuild myproj. Sln /p:Configuration="Debug|Win32" msbuild myproj.

Sln /p:Configuration="Debug|x64" I assume that if a developer is using Visual Studio then they'll only be generating the dlls so they can debug with them, and that you have a separate build process if you're actually deploying the dlls?

Yes, there's a separate build process when deploying the DLLs that can handle whatever command-line goodness and packaging that we need. But I want the developer machines running just Visual Studio to be able to easily hit "Build" and then be able to test both the x86 and x64 plugins. (Also slightly relevant, not everything in the solution needs an x64 version.

The configuration app can remain 32-bit only. ) – PeteVasi Oct 15 '09 at 21:39 For that particular use case I can't think of any other way of doing it than to set up a custom build rule that calls msbuild to build the other architecture. – the_mandrill Oct 16 '09 at 12:06 I've been toying with various custom build rules to try to get this to work, but haven't quite gotten there yet.

I've modified my original question to include all of my attempts. – PeteVasi Oct 16 '09 at 14:41.

You are not going to be able to do this with the UI of Visual Studio. For this you will need to hack the MSBuild files. Try this link from MSDN for MSBuild Overview.

Yes, I've been working with the MSBuild files (manually editing the *. Csproj anyway). I still haven't been able to get it to work.

– PeteVasi Oct 15 '09 at 19:17.

For C++, and if it's a project whose files/settings don't change often, one way to do it is create two projects within the solution, with both projects referring to the same source files. Then, in x64 builds, set one project to build 64-bit and the other 32-bit. (In x86 builds, set one as 32-bit and turn off the other.

) We've been using this for a while and it works fine. Of course, you have to be careful that any changes you make to one are also made to its copy. I.e.

If you add/remove a file or change its build setting you have to do it in two places. Source-code changes still only need to be done once because there's still only one copy of each source file. And, of course, you may decide that doing this is more complex/risky than switching away from using the IDE.

In our case it's worked really well, though.

I ran into this problem with a project running in VS2008 XP (32-bit) and also VS2010 7 (64-bit). The solution I used was to use the $(PROGRAMFILES) variable. It resolved correctly on both machines.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions