1

I have some older projects in non-SDK style which were created using Visual Studio; the csproj files were almost never modified manually. They were done partly by colleages before I came to this company, so I have very incomplete knowledge about what should or shouldn't be in these files.

Now I am trying to turn them into SDK-style projects by manually modifying the csproj files. In order to do that, I need to understand for each tag what it is for, and if it can be omitted or must be modified.

There might be

  • non-SDK-style leftovers that can just be deleted,
  • content we were not aware of (because we don't always know what we are doing when playing around with settings in a project),
  • content that needs to be modified to fit the new SDK-style specification,
  • content that can be omitted because it contains just its default value,
  • etc.

I try getting by by googling a given tag together with "csproj", but more often than not I cannot find useful content. I also noticed that most of the time I DO NOT find a source from Microsoft, mostly blog entries by private guys that sometimes, sometimes not tell me what I want to know.

There are some Microsoft docs like sdk reference or common properties, but they do not cover all tags that I have in my project.

So, how can I understand the content of my csproj file? Is the documentation there and I am merely not finding it? If so, what to search for? Shouldn't Microsoft have a comprehensive list of all possible tags? They have invented the csproj format, so they should know. Or do I need to learn something else first that is a prerequisite of working with csproj files (like before constructing bridges one should know about basic algebra and calculus), that will help me figure out stuff on my own?

3
  • The normal procedure is to throw away the old project file, and rebuild from scratch. That's normally a thousand times easier. Just look at the old file for hints of projects and NuGet packages to add to the project, and maybe other stuff that needs doing. Ask for help if you think something is important, but you don't understand what it might be. I believe the new project format can even be used for .NET 4 projects if need be. Commented Feb 9, 2022 at 13:30
  • @BentTranberg That's what I do - I start over with an empty csproj file, but go over all content of the old in order to decide if I need to include it (possibly modified) into the new one. Commented Feb 9, 2022 at 13:33
  • 1
    Good good. Your question tends toward being too broad. It's better if you can ask about the parts that you consider troublesome to figure out, and then maybe you'll get some help with that. Also, maybe you should consider just figuring out what end result you need, consentrate on how to achieve that with the new project format, and forget about the old. That old format has so much crap in it that's of no interest, and maybe just steals your time. Commented Feb 9, 2022 at 13:45

1 Answer 1

1

cproj files can have a lot of project configurations. Visual Studio Extensions might also modify cproj files and add custom values.

As per the comments on this answer, there isn't a complete list of available properties for Visual Studio projects. The links provided in the question contains most used properties, so that should cater for the average project.

It is very rare that properties will be used that is not contained in those links. If you do run across an unknown property, try searching online, if that fails, ask on SO.

A good search query that hasn't failed me yet, {Project Type} "{Property}" csproj property : .Net "TestProjectType" csproj property.

Sign up to request clarification or add additional context in comments.

9 Comments

The link you provide is already part of my question.
Sorry, I did miss that. Though, do take note of the first part of my answer. Without any insight, I cannot provide a better answer. Which properties are currently unknown?
At the moment, none (there might be later). My question is not about concrete tags, it is about how to deal with unknown tags in the best way. So far googling around HAS solved all my issues, but I attribute that to mere luck. You don't know any comprehensive list (or lists, one for each topic) either, do you?
The lists you posted are about it. It's very rare that unknowns should be added to the csproj file unless there is custom build logic built into the application. Don't think it's mere luck, think it's just because they didn't tinker with the files. So my best guess, everything should be standard.
SignAssembly is an example that is not listed in any of the two links in my question. I was not able to find a definitve saying on what its default value is (i.e. if tag not present), although it is quite clear using common sense - I assume false. But this is the kind of problem I have - for most tags I cannot find a definitive specification, I need to rely on either finding some blog entry (or SO question) or guessing.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.