-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Set publishDir for file based apps #49514
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
@dotnet/run-file for review please |
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
Updates the default publish directory for file-based apps and adds tests to verify the new behavior.
- Adds a
<PublishDir>
MSBuild property to the virtual project template. - Updates existing publish tests to assert on the new
artifacts/<ProjectName>
layout. - Introduces new tests covering custom publish directory scenarios (default, CLI override, and property directive).
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs | Switches tests to use publishDir and adds new publish-dir tests |
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs | Sets default <PublishDir>artifacts/$(MSBuildProjectName)</PublishDir> in generated project |
@@ -536,6 +536,7 @@ public static void WriteProjectFile( | |||
<PropertyGroup> | |||
<IncludeProjectNameInArtifactsPaths>false</IncludeProjectNameInArtifactsPaths> | |||
<ArtifactsPath>{EscapeValue(artifactsPath)}</ArtifactsPath> | |||
<PublishDir>artifacts/$(MSBuildProjectName)</PublishDir> |
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 assume this is relative to the "current csproj file", not "current working directory", right? So running dotnet publish ./subdir/app.cs
would result in ./subdir/publish/artifacts/app/app.exe
and not ./publish/artifacts/app/app.exe
. Consider adding a test for that.
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.
The file name of the project file without the file name extension; for example, MyApp.
RE PublishDir
, I believe it's relative to working directory, but I can't find docs for it.
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.
Seems it maps to OutputPath
:
}.ForwardAsOutputPath("PublishDir"); |
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.
OK, yes it's relative to the project directory:
Specifies the path to the output directory, relative to the project directory, for example, bin\Debug or bin\Debug$(Platform) in non-AnyCPU builds.
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.
Added a test to confirm and cover behavior.
Fixes: #49387