How to determine output folder of dnu/dotnet publish
Asked Answered
P

1

5

When I publish my project with

dotnet publish

it outputs to a folder

bin/Debug/dnxcore50/osx.10.11-x64/publish

(or perhaps the Release equivalent)

Is it possible to determine this folder location for a postpublish script specified in the project.json file?

Pathos answered 19/4, 2016 at 22:56 Comment(0)
P
12

Thanks to fast response on the dotnet/cli gitter channel, you can. The following variables are available:

%publish:ProjectPath%
%publish:Configuration%
%publish:OutputPath%
%publish:TargetFramework%
%publish:FullTargetFramework%
%publish:Runtime%

Source

And here are the ones for pre/postcompile:

%compile:TargetFramework%
%compile:FullTargetFramework%
%compile:Configuration%
%compile:OutputFile%
%compile:OutputDir%
%compile:ResponseFile%
%compile:RuntimeOutputDir%
%compile:RuntimeIdentifier%
%compile:CompilerExitCode%     // postcompile only

Source

Pathos answered 19/4, 2016 at 23:6 Comment(8)
These should be documented somewhere... Anywhere! project.json is a black box unless one can find the source code and analyse it.Mammal
@BradRobinson I don't understand exactly how to use these variables. I'm able to display for example OutputPath with <Message Text="$(OutputPath)"/> but not your %compile:OutputPath%. Because I'd like to know how to get the REAL OutputPath, if I display it, I get .\bin instead of .\bin\Debug\net461\win7-x64Babe
@JérômeMével The above variables are for use in your project.json file. I don't believe there is way of resolving bin\Debug\net461\win7-x64 from MSBuild. However using %compile:RuntimeOutputDir% in project.json will resolve to D:\...\<PROJECT>\bin\Debug\net461\win7-x64Mammal
Ho cool thank you, I didn't think I could finish the job using dotnet cliBabe
@Mammal I just found the full project.json schema, it might be useful linkBabe
@JérômeMével you absolute legend for finding that schema!! Much help! :)Mammal
@JérômeMével it does not have the complete list of variables that you can useAnimator
@Animator anyway project.json will be gone by the end of this year so better not spend to much time and efforts on itBabe

© 2022 - 2024 — McMap. All rights reserved.