<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Maximilian Leodolter</title>
    <description>The latest articles on DEV Community by Maximilian Leodolter (@max_onit).</description>
    <link>https://dev.to/max_onit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1639324%2F9514bbcc-4fda-43a4-8af4-d79a19aeff4d.jpeg</url>
      <title>DEV Community: Maximilian Leodolter</title>
      <link>https://dev.to/max_onit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/max_onit"/>
    <language>en</language>
    <item>
      <title>Deploy Your C# Blazor App To Vercel</title>
      <dc:creator>Maximilian Leodolter</dc:creator>
      <pubDate>Mon, 17 Jun 2024 12:32:42 +0000</pubDate>
      <link>https://dev.to/max_onit/deploy-your-c-blazor-app-to-vercel-258l</link>
      <guid>https://dev.to/max_onit/deploy-your-c-blazor-app-to-vercel-258l</guid>
      <description>&lt;p&gt;Vercel, known for its seamless deployment and scalability, is a popular choice among developers. While Vercel primarily supports JavaScript frameworks, it’s entirely possible to deploy C# applications too. Let's dive into how you can deploy your C# projects to Vercel, making your build fast and shipping faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Choose Vercel?
&lt;/h2&gt;

&lt;p&gt;Vercel offers a robust platform for deploying applications with ease. Its features include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automated Deployments: Every push to your Git repository can automatically deploy your app.&lt;/li&gt;
&lt;li&gt;Scalability: Vercel’s infrastructure scales your application effortlessly.&lt;/li&gt;
&lt;li&gt;Global Edge Network: Your applications are served from the edge, ensuring low latency and fast load times.&lt;/li&gt;
&lt;li&gt;Built-in CI/CD: Vercel integrates continuous integration and continuous deployment, streamlining your development workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we start, ensure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Vercel account&lt;/li&gt;
&lt;li&gt;Node.js installed on your machine&lt;/li&gt;
&lt;li&gt;.NET SDK installed&lt;/li&gt;
&lt;li&gt;Git installed and configured&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check if .NET is installed correctly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; dotnet &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thid command should output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; 8.0.XXX
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create a New C# Project
&lt;/h2&gt;

&lt;p&gt;First, let's create a new C# Blazor project. Open your terminal and run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet new blazorwasm &lt;span class="nt"&gt;-o&lt;/span&gt; NameOfYourProject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new Blazor project in a directory named NameOfYourProject.&lt;br&gt;
The directory contains by default an example project for you to play around.&lt;br&gt;
To get into more details read this tutorial from the official microsoft website: &lt;a href="https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/intro"&gt;https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/intro&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To run the project locally navigate into the project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;NameOfYourProject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use this command to start up the local development server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet watch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It even has hot reloading!&lt;/p&gt;

&lt;h2&gt;
  
  
  Build your Project for Deployment
&lt;/h2&gt;

&lt;p&gt;To deploy your C# application to Vercel, you need to build it first on your machine.&lt;br&gt;
Use this command to generate the output files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet publish &lt;span class="nt"&gt;-c&lt;/span&gt; Release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output files will be located in this folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bin/Release/net8.0/publish/wwwroot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please note that the exact path my vary a bit. Depending on your .NET version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Initialize a Git Repository
&lt;/h2&gt;

&lt;p&gt;Next, initialize a new Git repository and commit your code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No push the code to your git repository.&lt;br&gt;
First connect the github repo to your local repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add origin https://github.comXXXXX
git push origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Deploy to Vercel
&lt;/h2&gt;

&lt;p&gt;Now, it’s time to deploy your application to Vercel. Follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://vercel.com"&gt;Vercel&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Add New Project&lt;/li&gt;
&lt;li&gt;Select the repository from your github account&lt;/li&gt;
&lt;li&gt;Set custom Build &amp;amp; Development Settings&lt;/li&gt;
&lt;li&gt;Override the Output Directory to: &lt;em&gt;bin/Release/net8.0/publish/wwwroot&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thats it!&lt;br&gt;
You should now see a preview of your deployed C# Blazor App.&lt;/p&gt;

&lt;p&gt;If you want to publish changes follow these instructions:&lt;br&gt;
1.&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;bash dotnet publish -c Release&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;2.&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;git add . &amp;amp;&amp;amp; git commit -m "Your Commit Message"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;3.&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;git push origin master&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Vercel will take care of the rest and you should see the live changes in 1-2 minutes on your website.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Deploying C# applications to Vercel may seem unconventional given its JavaScript-centric nature. Vercel’s powerful platform allows you to build and ship your C# Blazor applications faster than ever.&lt;/p&gt;

&lt;p&gt;By following the steps outlined above, you can harness the power of Vercel for your C# projects, ensuring smooth deployments and high performance. So, gear up, start building, and ship your applications faster with Vercel!&lt;/p&gt;

&lt;p&gt;Checkout our services: &lt;a href="https://onit.eu"&gt;https://onit.eu&lt;/a&gt;&lt;br&gt;
we have more interesting articles on: &lt;a href="https://www.onit.eu/blog"&gt;https://www.onit.eu/blog&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>csharp</category>
      <category>git</category>
    </item>
  </channel>
</rss>
