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?
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:
<New>
in the dropdown. Type the config name you want (net462-source
). Confirm.This creates the needed lines in .sln
, to refer to that config for that project.
Substantive details are in each project’s .csproj
file.
Open both projects in a text editor (e.g. two tabs of Notepad++).
Find all lines that contain config’s name (net462-source
).
If the line is a section header, copy the entire section to the new project:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net462-source|SOMEcpuNAMEhere'">
...
</PropertyGroup>
If the line is not a section header, copy it to the new project. Within a similar section. (AFAIK, such non-section-header lines don't exist.)
Save file. Open solution in Visual Studio.
Examine project properties, of old and new projects. Change if needed.
Select the new config. Build and run.