Description
I'm trying to automate the publishing of a .Net Core app on the Mac/Linux command line using the "dotnet" tool. No command I've tried has resulted in the project getting published to the folder the publish profile specifies. The publish profile works when I use Visual Studio for Mac to directly publish the project. I've tried many variations of both the dotnet publish -p:PublishProfile=...
command and also dotnet build -p:DeployOnBuild=True -p:PublishProfile=...
. It looks like it's silently ignoring the PublishProfile I give it, and indeed the output doesn't look materially different if I give it an intentionally bad path.
I've tried specifying the csproj and not, pwd in the solution directory and in the project directory, and nothing seems to work except using Visual Studio instead of the dotnet CLI.
I'm running on a Mac running 10.15.5, and CentOS 7, both with dotnet 3.1.301.
My publish profile is the default folder publishing profile, named Properties/PublishProfiles/DockerImage.pubxml:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>AnyCPU</LastUsedPlatform>
<publishUrl>docker-image</publishUrl>
<DeleteExistingFiles>true</DeleteExistingFiles>
<TargetFramework>netcoreapp3.1</TargetFramework>
<SelfContained>false</SelfContained>
<_IsPortable>true</_IsPortable>
</PropertyGroup>
</Project>
I see this output, indicating the app was published to the default directory instead of the docker-image folder I specified:
> dotnet publish -p:PublishProfile=ProjectName/Properties/PublishProfiles/DockerImage.pubxml
Determining projects to restore...
All projects are up-to-date for restore.
ProjectName -> /Users/dfrankel/Projects/Solution Name/ProjectName/bin/Debug/netcoreapp3.1/ProjectName.dll
ProjectName -> /Users/dfrankel/Projects/Solution Name/ProjectName/bin/Debug/netcoreapp3.1/publish/