Written by
Maximilian Leodolter
Build fast - Ship faster.
Table of Contents
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.
Vercel offers a robust platform for deploying applications with ease. Its features include:
Before we start, ensure you have the following:
Check if .NET is installed correctly:
dotnet --version
Thid command should output:
8.0.XXX
First, let’s create a new C# Blazor project. Open your terminal and run the following commands:
dotnet new blazorwasm -o NameOfYourProject
This will create a new Blazor project in a directory named NameOfYourProject. The directory contains by default an example project for you to play around. To get into more details read this tutorial from the official microsoft website: https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/intro
To run the project locally navigate into the project folder:
cd NameOfYourProject
Use this command to start up the local development server:
dotnet watch
It even has hot reloading!
To deploy your C# application to Vercel, you need to build it first on your machine. Use this command to generate the output files.
dotnet publish -c Release
The output files will be located in this folder:
bin/Release/net8.0/publish/wwwroot
Please note that the exact path my vary a bit. Depending on your .NET version.
Next, initialize a new Git repository and commit your code:
git init
git add .
git commit -m "Initial commit"
No push the code to your git repository. First connect the github repo to your local repository:
git remote add origin https://github.comXXXXX
git push origin master
Now, it’s time to deploy your application to Vercel. Follow these steps:
Thats it! You should now see a preview of your deployed C# Blazor App.
If you want to publish changes follow these instructions:
bash dotnet publish -c Release
git add . && git commit -m "Your Commit Message"
git push origin master
Vercel will take care of the rest and you should see the live changes in 1-2 minutes on your website.
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.
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!