visual-studiobuild

Copy Build Configuration from another project in Visual Studio


I have a solution with many projects in it. I have added a new one, but it doesn't seem to share the same build configurations as the others. I want to copy the build configuration from another project and make it available to the new project.

As you can see in the image below, all my other projects have net462-source, but not the one for which I have lowered the drop down. It only has Debug and Release.

How do I copy the build configuration over?

enter image description here


Solution

  • There is no automated way to copy a custom configuration from one project to another.

    Lines need to be added to both your solution (.sln file), and the project that is missing the configuration.


    Fixing .sln is easy:

    This creates the needed lines in .sln, to refer to that config for that project.


    Substantive details are in each project’s .csproj file.

    <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net462-source|SOMEcpuNAMEhere'">
        ...
    </PropertyGroup>