dotnet run file.cs
#:
directive for project references
#48746
Labels
Area-run-file
Items related to the "dotnet run <file>" effort
untriaged
Request triage from a team member
Is your feature request related to a problem? Please describe.
The
dotnet run file.cs
document lists#:
directives to specify the SDK, properties and NuGet package references of the implicit project file, but doesn't list a directive to reference a C# project.Describe the solution you'd like
A
#:project
directive (or equivalent) to reference a "full" C# project by its absolute/relative path, which translates to<ProjectReference Include="..." />
in the implicit project file.Maybe a
#:reference
directive to reference .DLLs in a similar way, which translates to<Reference Include="..." />
to my understanding? (although, I don't have any experience with this 😅).Additional context
I think project references would be very useful to ship smol helper scripts alongside a main project?
e.g., a main ASP.NET Core web project
Server/Server.csproj
withServer/Program.cs
and an EF Core DB contextServer/Db.cs
, and ascripts/firstRun.cs
helper script which sets up the project for local development by creating an initial user, etc. using the DB context/services of the main project.Program.cs
would look roughly like,...and the
firstRun.cs
helper script would look like,The text was updated successfully, but these errors were encountered: