Leaving the --output parameter to its default value means that the project will be published to bin/Release/netcoreap2.0/publish
By that I mean that the dlls etc can be found in the folder named publish in that path.
If you use the --output parameter to change the publish path, the behavior changes unexpectedly.
doing dotnet publish --output bin/publish means the project will be published to bin/publish/ProjectName instead of just the publish folder named.
This is obviously bad and confusing, and should be changed. In the mean time, is there a way to workaround this problem?
Create an empty netcoreapp2.0 web project. publish it to a specific folder using dotnet publish --output bin/publish
The app dll is published to bin/publish
The app dll is published to bin/publish/ProjectName
dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032
Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:Program Filesdotnetsdk2.1.401
Host (useful for support):
Version: 2.1.3
Commit: 124038c13e
.NET Core SDKs installed:
2.1.401 [C:Program Filesdotnetsdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.3 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.3 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Hi @Zazcallabah. Sorry it took so long to get back to you regarding this issue.
I'm unable to reproduce this with a 2.1.504 SDK (as well as the latest build of the SDK out of master).
When I publish with --output bin/publish I get a ./bin/publish directory that does not contain a project-named subdirectory and it contains what you expected: the publish output only.
Are you still able to reproduce this and, if so, could you share a simple repro project? Thank you.
No, you are correct, I can't reproduce it myself with the instructions given in the post above. I've tried a couple of different sdk versions and they all work as they should.
Unfortunately I no longer have access to the project that spawned the issue, so I'll have to close this issue.
@Zazcallabah Thanks for confirming. If you are able to reproduce it again, please reactivate the issue and I'll take a look.
I've got the same issue on Azure Pipelines using the following task for an ASP.NET Core 2.2 application.
- task: DotNetCoreCLI@2
displayName: 'Publish sample .NET Core App'
inputs:
command: publish
publishWebProjects: false
zipAfterPublish: false
projects: 'ExampleNetCoreProject/**/*.csproj'
configuration: ${{ parameters.buildConfiguration }} # Release
arguments: -o drop-packages-dotnetcore
The publish logs will output the following:
ExampleNetCoreApp -> /home/vsts/work/1/s/ExampleNetCoreProject/ExampleNetCoreApp/drop-packages-dotnetcore/ExampleNetCoreApp/
For some reason it adds another directory to the publish path with the same name as the project. The publish command doesn't have this behavior when testing it on my local machine. The task is running on a ubuntu-16.04 image.
EDIT:
Not sure if this is expected behavior or not since it publishes a zipped directory, but I've disabled zipping it so it just publishes a regular directory inside the output map. Either way the behavior of the CLI command on Azure is different than locally publishing it...
Found out about this when trying to run the application in a Docker container but it couldn't find the .dll in the published map (because it added the extra directory, where the .dll actually located!).
The documentation isn't really clear about it either..
found it:
modifyOutputPath
Add project name to publish path | (Optional) If true, folders created by the publish command will have project file name prefixed to their folder names when output path is specified explicitly in arguments. This is useful if you want to publish multiple projects to the same folder.聽Default value: true
It should be set as false
Most helpful comment
found it:
modifyOutputPath
Add project name to publish path | (Optional) If true, folders created by the publish command will have project file name prefixed to their folder names when output path is specified explicitly in arguments. This is useful if you want to publish multiple projects to the same folder.聽Default value: true
It should be set as false