Developer Notes

Vercel

JAMStack on .NET : Hosting on Vercel

Vercel (formerly known as Zeit) are the people behind Next.js and offer a very nice platform to deploy and run JAMStack sites. But how does it deal with a .NET based JAMStack site?

In a nutshell

Vercel has a very complete offering including some of the more advanced features like edge caching of your API requests.

Building .NET is not included but can be configured for the build pipelines. At runtime there is no .NET support. On the other hand, it has a CLI, allowing you to build anywhere and deploy to the site.

Deployment

Integrated buildVery extensible
Deploy from Github ActionsVia 3rd party open-source actions or by pushing the site into a branch
Deploy from Azure PipelinesCould probably make this work using Vercel CLI
Deploy from CLIRequires a bit of config but works well

Tooling

VS Code extensionsNothing substantial
CLI toolingVery good

Hosting

Serverless functionsNode, Go, Python, Ruby
Extensionless urls
Proxy API callsThrough serverless functions or edge functions.
Custom 404Provide a 404.html or use a function
AuthenticationNeeds 3rd party solution, you'll need to do a bit of dev work.
CDNIncluded and controllable

General

DocumentationExcellent
CostFree tier to get started and pretty decent ramp up for commercial use

.NET support

With a little bit of tweaking, Vercel can build .NET Core and later. The excellent documentation mentions the build runs Amazon Linux 2 containers which apparently is very similar to Cent OS. And indeed the instructions for installing the .NET SDK on Cent OS work.

Vercel project settings for build & deployment
Vercel project settings for build & deployment

Under the Build & Development Settings for your project set the Framework preset to Other and override the settings. For example, for a static website using Statiq the following settings will work:

SettingValue
Build Commanddotnet run --configuration Release
Output Directoryoutput
Install Commandrpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm && yum install dotnet-sdk-3.1 -y

Conclusion

Vercel gets a thumbs up for excellent docs and flexibility. The platform is geared towards javascript based development but, with a bit of configuration, works well for .NET generated sites. You'll have to back the site with an API hosted elsewhere if you want that in .NET as well.

Further reading

1 Comments

  • Image placeholder

    ANSELMO CASTRO

    06/23/2022

    hello friend thank you very much for the information. I tested but inside the vercel my project gave this "Error: Command "dotnet run --configuration Release", has another way to perform the "Build Command" ?