3

I've been trying to follow multiple (example) tutorials about how to place an asp.net Web API onto a docker image. And in pretty much all of them use a docker file in which the following command is done dotnet [csproj name] -c Release -o out and then eventually copy the information from this to another folder. however, I kept getting issues with the folder out not being found. So I decided to use this command locally, and to my amazement found out that no out folder is ever produced, nor anything is built.

When we look at the documentation of the dotnet publish on it we can see it says the following:

Packs the application and its dependencies into a folder for deployment to a hosting system.

and

-o|--output <OUTPUT_DIRECTORY> Specifies the path for the output directory. If not specified, it defaults to ./bin/[configuration]/[framework]/publish/ for a framework-dependent deployment or ./bin/[configuration]/[framework]/[runtime]/publish/ for a self-contained deployment. If the path is relative, the output directory generated is relative to the project file location, not to the current working directory.

And yes, I've tried pretty much every solution from here.

Which seems to me that this command should make a new folder in which all the published files are placed into. So my question is: Am I mistaken, or is there an issue at play here and what is the solution for the issue?

Dennis.Verweij
  • 116
  • 1
  • 9

1 Answers1

3

Yes it will create the output folder, however until .NET Core 3.0 tooling, any non-absolute path is interpreted relative to the project's directory.

So until 3.0, dotnet publish subdir(project.csproj -o otherdir will create a subdir/otherdir directory.

Also note that dotnet publish will print the path it publishes to in its output.

Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217
  • this didn't really solve my issue, I found another way around of getting done what I wanted to do (which doesn't uses dotnet CLI). But thank you none the less. – Dennis.Verweij Oct 24 '18 at 12:51
  • 1
    The differences from pre-3.0 behaviour is not documented yet either, causing missing files in automated builds until lots of troubleshooting... – Gert van den Berg May 22 '19 at 14:53