1

Is it possible to build and publish the code at the same time using .net core 2.0

I have console application which I have created in .net and inside the same solution have some libraries which is targeting to framework 4.5. I am looking for the command which can build and at the same time publish as Self contained.

Can anyone please suggest me the command which can build and publish at the same time as Self Contained.

2
  • 1
    Possible duplicate of .Net Core how works dotnet publish command Commented Jul 30, 2019 at 3:55
  • Do you only want to build and publish the single .net core project? (I'm bit confused about the reason you mentioned you have some libraries in the solution) You can use dotnet publish xx.csproj ... to specify the project you want to build and publish. Commented Jul 30, 2019 at 15:50

1 Answer 1

1

The dotnet publish command has two parameters that you'll need to specify:

  • The --self-contained flag does exactly what you think; tells the command to publish an application that is totally self contained.
  • The -r|--runtime flag specifies which target operating system the application should be able to run on.

You can find more details in the full docs here: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore21#arguments

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.