When should I use dotnet publish over dotnet build in my CI CD workflow

0 votes
When should I use dotnet publish over dotnet build in my CI/CD workflow?

In the context of CI/CD pipelines and getting applications ready for release, this question aims to elucidate situations in which dotnet publish is preferable to dotnet build.
Dec 6, 2024 in DevOps Tools by Anila
• 5,070 points
98 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

In conclusion, the code is compiled using dotnet build, and it is then ready for deployment by incorporating all required runtime dependencies using dotnet publish. In the following situations, you should use dotnet publish rather than dotnet build in your CI/CD workflow:

Getting ready for deployment:

When you need to prepare the application for deployment, use dotnet publish. The code must be compiled and packaged with its dependencies, configuration files, and runtime-specific binaries to prepare for deployment to a server, container, or cloud environment.


Build for Release:

Dotnet publish should be used to generate the application's release version, which includes any framework-dependent or self-contained packages. This is required when the finished artifacts must be moved to production or staging settings.


Containerization: 

Dotnet publish assists in getting the required files ready for containerization and making sure the runtime environment is configured properly if you are deploying your application to a container (such as Docker).


For local development or integration testing, use dotnet build to compile and validate code; however, when you're prepared for deployment, use dotnet publish.

answered Dec 6, 2024 by Gagana
• 10,030 points

edited Mar 6

Related Questions In DevOps Tools

0 votes
2 answers
+1 vote
1 answer

i have a pyhton code in my git/git repository how to build that code in jenkins

Follow these steps @Bhaskar: Step 1: Open the Jenkins ...READ MORE

answered Oct 14, 2019 in DevOps Tools by Kalgi
• 52,350 points
1,038 views
0 votes
1 answer

How do you troubleshoot slow build times in CI/CD pipelines?

Optimize build times in CI/CD pipelines as ...READ MORE

answered Nov 4, 2024 in DevOps Tools by Gagana
• 10,030 points
242 views
0 votes
1 answer

What techniques have helped you reduce build times in CI/CD tools like Jenkins?

Caching and Artifact Reuse: Caching dependencies and ...READ MORE

answered Nov 3, 2024 in DevOps Tools by Gagana
• 10,030 points
139 views
0 votes
1 answer

How do you handle resource contention when multiple jobs run simultaneously in CI/CD pipelines?

I address resource contention in CI/CD pipelines ...READ MORE

answered Nov 18, 2024 in DevOps Tools by Gagana
• 10,030 points
225 views
0 votes
0 answers
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
4,471 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,274 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP