question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add the ability to write comments in a solution (.sln) file

See original GitHub issue

I think it would be beneficial to allow for comments in a solution file, since not all solution files are generated/managed by an IDE, but directly edited in a text editor. There are articles/comments online that say the # character is used for comments, but that’s not quite how the solution file is processed by msbuild:

https://github.com/microsoft/msbuild/blob/0f3d8e94ac11dd892c0c2fadb28b1a42e0d45fb1/src/Build/Construction/Solution/SolutionFile.cs#L435-L462

EDIT: Removed ambiguous references and other formatting.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
alantacommented, Jun 17, 2019

Another use case for this is to allow excluding parts of a .sln file in a dotnet new template. For example:

#if (includedatabase)
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microservice.Database", "Microservice.Database\Microservice.Database.csproj", "{6F650E2B-8E2C-414A-A5CA-6B983B39746B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microservice.Database.Migrations", "Microservice.Database.Migrations\Microservice.Database.Migrations.csproj", "{51DCC1F2-D929-429C-80AD-F446C8386CE1}"
EndProject
#endif

This is part of a solution file that’s packaged up into a template and processed when the package is newed up. The comments are processing instructions for dotnet new.
To verify the solution before packaging I tried to build it, but after adding these comments the solution no longer builds from the CLI (.NET Core 3.0 preview 6). I can load it in Visual Studio 2019 without problems though.

2reactions
simplexidevcommented, Apr 22, 2019

Which works only for top-level elements. If Visual Studio’s solution parser handles comment lines elsewhere, MSBuild’s should too.

My main use case for this is to separate the ProjectConfigurationPlatforms in the global sections, so it’s easier to see what is what when you have numerous projects in a solution, so top-level comments don’t really help in that situation.

EDIT: I don’t know if VS’s parser handles comments, but i agree that the implementations should parse two identical files the same, comments or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add the ability to write comments in a solution (.sln) file
I think it would be beneficial to allow for comments in a solution file, since not all solution files are generated/managed by an...
Read more >
Comment lines in .sln file
1 Answer. I don't think there is an official definition of comments in the . sln file. It depends on the parser.
Read more >
Project Solution (.sln) file - Visual Studio (Windows)
Learn about the .sln file, which is one of the files that maintains state information for a project in Visual Studio.
Read more >
noob question: sln files : r/csharp
Why is it that in the folder containing my SLN file, I can see the same files that I would see when opening...
Read more >
Cannot debug net6.0-macos Apps - Developer Community
This is a regression. I can no longer debug net6.0-macos apps. It also fails for net6.0-maccatalyst apps. When I hit debug, the following ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found