Sdk: dotnet publish does not set OutDir

Created on 16 Jan 2018  路  2Comments  路  Source: dotnet/sdk

Steps to reproduce

Create a netCore 2.0 project and set the following properties in the csproj

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="echo OutPath: $(OutputPath)" />
<Exec Command="echo OutDir: $(OutDir)" />
</Target>

execute a publish
dotnet publish -c Release -o dist

Expected behavior

OutDir is set to dist/

Actual behavior

OutDir is set to bin/Release/netcoreapp2.0/

Environment data

.NET Command Line Tools (2.1.4)

Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.1.4/

Microsoft .NET Core Shared Framework Host

Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54

Most helpful comment

After a lot of googling I've discovered that this method sets the $PublishDir

This should be documented better on the dotnet cli docs as it is not listed anywhere in the new .netcore 2.0, docs that I have come across atleast.

For anyone coming across this issue having similar problems a more reliable method would be to use msbuild and specify exacting properties.

dotnet msbuild /t:publish /p:PublishDir=dist/ /p:Configuration=Release

All 2 comments

After a lot of googling I've discovered that this method sets the $PublishDir

This should be documented better on the dotnet cli docs as it is not listed anywhere in the new .netcore 2.0, docs that I have come across atleast.

For anyone coming across this issue having similar problems a more reliable method would be to use msbuild and specify exacting properties.

dotnet msbuild /t:publish /p:PublishDir=dist/ /p:Configuration=Release

@mairaw for improving the documentation.

Was this page helpful?
0 / 5 - 0 ratings