<?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: Sunil Vijendra</title>
    <description>The latest articles on DEV Community by Sunil Vijendra (@sunilvijendra).</description>
    <link>https://dev.to/sunilvijendra</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%2F399345%2Fd0bb2888-24f1-4270-82e5-6ba326fa61de.jpeg</url>
      <title>DEV Community: Sunil Vijendra</title>
      <link>https://dev.to/sunilvijendra</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sunilvijendra"/>
    <language>en</language>
    <item>
      <title>Setting up development environment for Blazor WebAssembly</title>
      <dc:creator>Sunil Vijendra</dc:creator>
      <pubDate>Mon, 01 Jun 2020 04:19:54 +0000</pubDate>
      <link>https://dev.to/sunilvijendra/setting-up-development-environment-for-blazor-webassembly-2cn6</link>
      <guid>https://dev.to/sunilvijendra/setting-up-development-environment-for-blazor-webassembly-2cn6</guid>
      <description>&lt;p&gt;I recently took a module on &lt;a href="https://docs.microsoft.com/en-us/learn/" rel="noopener noreferrer"&gt;Microsoft Learn&lt;/a&gt; called &lt;a href="https://docs.microsoft.com/en-us/learn/modules/build-blazor-webassembly-visual-studio-code/" rel="noopener noreferrer"&gt;Building webapps with Blazor&lt;/a&gt;. Hit some road blocks in setting up the development environment. Sharing my learning here.&lt;/p&gt;

&lt;p&gt;I have Visual Studio 2019 installed on my machine (think its 16.4 version) so the dotnet core SDK comes along with it. All of below commands I ran from VS Developer command prompt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; dotnet --version
3.1.101
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get started, create a new project as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; dotnet new blazorwasm -o CICalc
No templates matched the input template name: blazorwasm.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hmmm...I thought I had this covered as I have VS 2019!!! So, I need to install the template.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0

&amp;gt; dotnet new blazorwasm -o CICalc

The template "Blazor WebAssembly App" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on C:\Work\BuildChallenge\CICalc\CICalc.csproj...
  Restore completed in 10 sec for C:\Work\BuildChallenge\CICalc\CICalc.csproj.

Restore succeeded.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is cool! Lets run...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; dotnet run
&amp;lt;bunch of build errors&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is tricky! So, lets copy that error and Google...and I figure that I should update to latest dotnet core SDK. So, I did a VS update from from 16.4 to 16.6. If you do not have Visual Studio then download the latest .NET core SDK from &lt;a href="https://dotnet.microsoft.com/download" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; dotnet --version
3.1.300

&amp;gt; dotnet run
crit: Microsoft.AspNetCore.Server.Kestrel[0]
      Unable to start Kestrel.
System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
&amp;lt;&amp;lt;snip&amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wait, when dotnet core SDK is installed, it should come with a developer certificate. Lets generate a certificate and trust the same:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; dotnet dev-certs https
&amp;gt; dotnet dev-certs https --trust
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives a pop-up like below!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0b89t9tcjkq6ub184hiy.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0b89t9tcjkq6ub184hiy.PNG" alt="Install Developer https cert"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Restart the command prompt and go to project folder and run the app. If it still does not work (which was the case with me!!), do the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; dotnet dev-certs https --clean
&amp;gt; dotnet dev-certs https -t
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running these, restart the developer command prompt and go to the project folder and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\Work\BuildChallenge\CICalc&amp;gt;dotnet run
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Work\BuildChallenge\CICalc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And open browser with &lt;a href="https://localhost:5001" rel="noopener noreferrer"&gt;https://localhost:5001&lt;/a&gt; and you should see your First Blazor app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9d8mr9apa0komvxwzjvv.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9d8mr9apa0komvxwzjvv.PNG" alt="First Blazor app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Learning!&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>blazor</category>
      <category>webassembly</category>
      <category>microsoftlearn</category>
    </item>
  </channel>
</rss>
