-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add spec for dotnet run file.cs
#47020
base: main
Are you sure you want to change the base?
Conversation
jjonescz
commented
Feb 21, 2025
•
edited
Loading
edited
- Rendered markdown
- First implementation stage: Add basic support for 'dotnet run file.cs' #46915
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
So, suppose All of that seems fine to me. Just putting together the larger picture in my mind. Also, will it be possible to make |
You mean like launch target? I guess yes, same as if
No, the
I think you can add arbitrary files as "Solution Files" even today. You would have to add all your project-less |
I was thinking of this one: I guess it is called the "projects" list, though, it is really populated with each TFM for each project. It sounds like actually |
Getting off topic a bit, but just to follow up with Rikki's comments, if a source file is part of multiple projects via TFM as shown, or by source linking, it shows each project it's a part of: So conceptually it would make sense to have each entry file as a 'project' that the shared files would be a part of. |
This is a key decision point in the design though. Either we see the "shared files" project as a separate project which is When we get further along with this, it would probably be good to write up several more examples of file structures here. That is, executable and non-executable files at various levels of nesting, with and without project files already present on disk, and what we think should happen in terms of which virtual projects exist and what the virtual projects contents are (like which files are included in them). |
Personally, I would 100% expect it to be a "source included" model. |
Currently the proposal describes the "project references" model, not "source included". That's because, in my opinion, we strive for the simplest "implicit project file" experience. "Source included", "IVTs", etc, are advanced scenarios and if we did them and wanted to preserve the semantics during "grow up", we would need to generate complicated project files, but we want to avoid that. I don't see any problems with "project references" model. Yes, your shared utility classes need to be |
Hmm, from the spec I can see why that would be the case, but it does seem extremely confusing as its kind of counter to the way it works (at least in my head) with the no project file case. Because if I have a case like
Then it seems intuitive (to me) that there is one virtual project file If I then add another entry point:
Then (my) intuition follows that there are two virtual project files:
So effectively a source-shared model where both projects can see internals. Not that I think a shared source model makes it easier to keep the semantics similar to I'm not actually sure how much sense it makes to grow up project files on an individual basis, but it also seems weird you end up with different things depending on having 1 or N entry points. Because the 'project-ref' model is sort of treating the folder as an implicit I appreciate this all seems kind of nit-picky, but I think it's really important we think through exactly how grow up works if we allow implicit file inclusion as I think it really muddies these stories. |
You're right, it indeed seems confusing if going from 1 to multiple entrypoints changes behavior like that, I haven't fully realized that's going to happen. Given that, I agree that source shared model seems better. Thanks. Or perhaps IVT wouldn't be that bad either. |
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.
Good starting point. A few comments but nothing that should be considered blocking.
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.
Really excited about this feature!
I think we should reconsider the globbing behavior.
The current approach optimizes for the fact that these files will become projects eventually, but the motivation calls out scripting as a scenario.
I feel like for scripting, you'd prefer to just load the single file and just go from there.
Think having the cs file in the root of the repo for example.
Another idea would be do build authoring in the cs file eventually. Importing nested folders would conflict with that.
Consider that scripts often grow up into more complicated standalone utility programs.
I guess it wouldn't be as straightforward, but I wouldn't say it conflicts. You can absolutely have |