-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update dotnet run file.cs
spec with new ignored directives syntax
#47543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the dotnet run file documentation to reflect the new ignored directives syntax for project metadata. Key changes include updating the description of entry-point file checks, renaming and reformatting directive examples (using "#:" prefixes instead of "#"), and clarifying how these directives are translated into MSBuild project elements.
Comments suppressed due to low confidence (2)
documentation/general/dotnet-run-file.md:182
- [nitpick] Consider using a single space between the directive and its value for consistency with other examples.
#:sdk Microsoft.NET.Sdk.Web
documentation/general/dotnet-run-file.md:211
- [nitpick] Revise the bullet point formatting to ensure consistency with the previous bullet, which could improve clarity.
- error on multiple `#:sdk` directives.
The C# language needs to be updated to ignore these directives (instead of failing the compilation). | ||
See [the corresponding language proposal][pound]. | ||
The value must be separated from the name of the directive by white space and any leading and trailing white space is not considered part of the value. | ||
The value of `#:sdk` is injected into `<Project Sdk="{0}">` as is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you had the SDK not actually in the SDK= part but imported manually so you could overwrite certain bits? Is that changing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's not changing, but I would consider that to be an internal implementation detail (and it should go away if/when NuGet fixes their targets to not fail on virtual project files). Having <Project Sdk="..."> ... </Project>
should be equivalent to <Project> <Import props /> ... <Import targets /> </Project>
(I believe the former is just "syntactic sugar" for the latter, but I might be wrong).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough
See [the corresponding language proposal][pound]. | ||
The value must be separated from the name of the directive by white space and any leading and trailing white space is not considered part of the value. | ||
The value of `#:sdk` is injected into `<Project Sdk="{0}">` as is. | ||
The value of `#:property` is split by the first `=` and injected as `<{0}>{1}</{0}>` in a `<PropertyGroup>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pass multiple like:
#property foo=fooV;bar=barV
etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pass multiple like
#:property foo=fooV
#:property bar=barV
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's reasonable. I'm a bit split as to whether I think it's best to leave it like that or also permit the #property foo=fooV;bar=barV syntax. On the one hand, MSBuild (from the command line) supports either; on the other hand, I don't think that enables anything new, and this syntax is more similar to C# code, which feels appropriate. I think I'm happy with this.
``` | ||
|
||
The C# language needs to be updated to ignore these directives (instead of failing the compilation). | ||
See [the corresponding language proposal][pound]. | ||
The value must be separated from the name of the directive by white space and any leading and trailing white space is not considered part of the value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm definitely in favor of the package directive. I'm ok with the others, but I want to make sure that we have a clear end point. I don't mind adding things like this as they become necessary, but at some point, we should say "you seem to want a csproj without the csproj. Can you just use a csproj?"
No description provided.