Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

How to define custom configurations in new-style .csproj?

+4
−0

Problem

I'm trying to update some projects from old-style .csproj:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  etc.

to new-style:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  etc.

One group of projects has a custom configuration, in addition to the standard Debug and Release. After I convert a project from this group, VS gives an error message:

Current solution contains incorrect configuration mappings. It may cause projects to not work correctly. Open the Configuration Manager to fix them. [Open Configuration Manager]

(where the square brackets represent a button). If I click the button, or open the configuration manager by other means, it updates the .sln file to use Debug instead of the custom configuration in the converted project.

What I've tried

I've tried using the configuration manager to create a new configuration for the project, copying from Debug: this does absolutely nothing, not even an error dialog telling me that it can't do it.

I've tried adding a stanza to the converted .csproj to try to "define" the configuration:

  <PropertyGroup Condition="'$(Configuration)' == 'Dev Cloud'">
    <DefineConstants>TRACE;DEBUG;DEVCLOUD</DefineConstants>
    <Optimize>false</Optimize>
    <DebugType>full</DebugType>
    <ErrorReport>prompt</ErrorReport>
    <Prefer32Bit>true</Prefer32Bit>
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>

This also fails to achieve anything.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+3
−0

I decided to tackle this again via the route of creating a new solution project-by-project, and this time the configuration manager actually did something useful. Specifically, it added a property to the csproj:

  <Configurations>Debug;Release;Dev Cloud</Configurations>

This seems to be the key: the old solution now loads and understands the project configuration.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »