How can I use a single Visual Studio solution to build both x86 and x64 at the same time?

前端 未结 8 1823
我寻月下人不归
我寻月下人不归 2020-12-12 17:06

I\'ve got an x86 Visual Studio solution with many project files in it. Some of the DLL files are designed to work as plug-ins to other applications on a user\'s system.

相关标签:
8条回答
  • 2020-12-12 17:56

    I would suggest to create a dummy C++ Makefile project and then invoke MSBuild twice from it:

    msbuild myproj.sln /p:Configuration="Debug|Win32" 
    
    msbuild myproj.sln /p:Configuration="Debug|x64"
    
    0 讨论(0)
  • 2020-12-12 18:05

    Importing a project in such manner works for me in Visual Studio 2010:

    TestProject64.vcxproj

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <Import Project="TestProject.vcxproj" />
      <ItemGroup Label="ProjectConfigurations">
        <ProjectConfiguration Include="Release|x64">
          <Configuration>Release</Configuration>
          <Platform>x64</Platform>
        </ProjectConfiguration>
      </ItemGroup>
      <PropertyGroup Label="Globals">
        <ProjectGuid>{B7D61F1C-B413-4768-8BDB-31FD464AD053}</ProjectGuid>
      </PropertyGroup>
    </Project>
    

    TestProject64.vcxproj.filters

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <Import Project="TestProject.vcxproj.filters" />
    </Project>
    

    TestProject.vcxproj has two configurations defined inside: Release|x86 and Release|x64. As you can see, TestProject64.vcxproj has only the Release|x64 configuration. Defining of at least one configuration in TestProject64.vcxproj is necessary, otherwise Visual Studio will not be able to add TestProject64.vcxproj to a solution.

    Now it's possible to include both TestProject.vcxproj and TestProject64.vcxproj to the same solution and build Release|x86 and Release|x64 at the same time.

    0 讨论(0)
提交回复
热议问题