Congratulations!

[Valid RSS] This is a valid RSS feed.

Recommendations

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

Source: http://www.hanselman.com/blog/SyndicationService.asmx/GetRss

  1. <rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:webfeeds="http://webfeeds.org/rss/1.0" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0"><channel><webfeeds:logo>https://www.hanselman.com/blog/images/zenicon.jpg</webfeeds:logo><webfeeds:analytics id="UA-130207-1" engine="GoogleAnalytics" /><title>Scott Hanselman</title><link>https://www.hanselman.com/blog/</link><description>Scott Hanselman's Thoughts on Programming, Technology, Fatherhood, and Life</description><image><url>https://www.hanselman.com/blog/images/zenicon.jpg</url><title>Scott Hanselman</title><link>https://www.hanselman.com/blog/</link></image><copyright>Scott Hanselman</copyright><lastBuildDate>Tue, 27 Jun 2023 17:17:25 GMT</lastBuildDate><managingEditor>scott@hanselman.com</managingEditor><webMaster>scott@hanselman.com</webMaster><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/7fbeba21-edbe-4af4-b909-26b6ba644546</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/7fbeba21-edbe-4af4-b909-26b6ba644546</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/using-wsl-and-lets-encrypt-to-create-azure-app-service-ssl-wildcard-certificates/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/7fbeba21-edbe-4af4-b909-26b6ba644546</wfw:commentRss><slash:comments>3</slash:comments><title>Using WSL and Let's Encrypt to create Azure App Service SSL Wildcard Certificates</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/7fbeba21-edbe-4af4-b909-26b6ba644546</guid><link>https://www.hanselman.com/blog/using-wsl-and-lets-encrypt-to-create-azure-app-service-ssl-wildcard-certificates</link><pubDate>Tue, 27 Jun 2023 17:17:25 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;There are many let's encrypt automatic tools for azure but I also wanted to see if I could use certbot in wsl to generate a wildcard certificate for the azure Friday website and then upload the resulting certificates to azure app service. &lt;/p&gt; &lt;p&gt;Azure app service ultimately needs a specific format called dot PFX that includes the full certificate path and all intermediates.&lt;/p&gt; &lt;p&gt;Per the docs, App Service private certificates must meet &lt;a href="https://learn.microsoft.com/en-us/azure/app-service/configure-ssl-certificate?tabs=apex%2Cportal#private-certificate-requirements"&gt;the following requirements&lt;/a&gt;:  &lt;ul&gt; &lt;li&gt;Exported as a password-protected PFX file, encrypted using triple DES.  &lt;li&gt;Contains private key at least 2048 bits long  &lt;li&gt;Contains all intermediate certificates and the root certificate in the certificate chain.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;If you have a PFX that doesn't meet all these requirements you can have Windows reencrypt the file.&lt;/p&gt; &lt;p&gt;I use WSL and certbot to create the cert, then I import/export in Windows and upload the resulting PFX.&lt;/p&gt; &lt;p&gt;Within WSL, install certbot:&lt;/p&gt;&lt;pre class="gutter: false; toolbar: false; smart-tabs: false;"&gt;sudo apt update&lt;br&gt;sudo apt install python3 python3-venv libaugeas0&lt;br&gt;sudo python3 -m venv /opt/certbot/&lt;br&gt;sudo /opt/certbot/bin/pip install --upgrade pip&lt;br&gt;sudo /opt/certbot/bin/pip install certbot&lt;/pre&gt;
  2. &lt;p&gt;Then I generate the cert. You'll get a nice text UI from certbot and update your DNS as a verification challenge. Change this to make sure it's &lt;strong&gt;two&lt;/strong&gt; lines, and your domains and subdomains are correct and your paths are correct.&lt;/p&gt;&lt;pre class="gutter: false; toolbar: false; smart-tabs: false;"&gt;sudo certbot certonly --manual --preferred-challenges=dns --email YOUR@EMAIL.COM   &lt;br&gt;    --server https://acme-v02.api.letsencrypt.org/directory   &lt;br&gt;    --agree-tos   --manual-public-ip-logging-ok   -d "azurefriday.com"   -d "*.azurefriday.com"&lt;br&gt;sudo openssl pkcs12 -export -out AzureFriday2023.pfx &lt;br&gt;    -inkey /etc/letsencrypt/live/azurefriday.com/privkey.pem &lt;br&gt;    -in /etc/letsencrypt/live/azurefriday.com/fullchain.pem&lt;/pre&gt;
  3. &lt;p&gt;I then copy the resulting file to my desktop (check your desktop path) so it's now in the Windows world.&lt;/p&gt;&lt;pre class="gutter: false; toolbar: false; smart-tabs: false;"&gt;sudo cp AzureFriday2023.pfx /mnt/c/Users/Scott/OneDrive/Desktop
  4. &lt;/pre&gt;
  5. &lt;p&gt;Now from Windows, import the PFX, note the thumbprint and export that cert.&lt;/p&gt;&lt;pre class="brush: ps; gutter: false; toolbar: false; smart-tabs: false;"&gt;Import-PfxCertificate -FilePath "AzureFriday2023.pfx" -CertStoreLocation Cert:\LocalMachine\My &lt;br&gt;    -Password (ConvertTo-SecureString -String 'PASSWORDHERE' -AsPlainText -Force) -Exportable&lt;br&gt;&lt;br&gt;Export-PfxCertificate -Cert Microsoft.PowerShell.Security\Certificate::LocalMachine\My\597THISISTHETHUMBNAILCF1157B8CEBB7CA1 &lt;br&gt;    -FilePath 'AzureFriday2023-fixed.pfx' -Password (ConvertTo-SecureString -String 'PASSWORDHERE' -AsPlainText -Force) &lt;/pre&gt;
  6. &lt;p&gt;Then upload the cert to the Certificates section of your App Service, under Bring Your Own Cert. &lt;/p&gt;&lt;figure&gt;&lt;img title="Custom Domains in Azure App Service" style="display: inline" alt="Custom Domains in Azure App Service" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Using-WSL-and-Lets-Encrypt-to-create-Azu_C384/image_3849c466-fcdb-4abd-96ad-8d52a5e93730.png" width="858" height="437"&gt;&lt;/figure&gt;
  7. &lt;p&gt;Then under Custom Domains, click Update Binding and select the new cert (with the latest expiration date).&lt;/p&gt;
  8. &lt;p&gt;&lt;img title="image" style="margin: 0px; display: inline" alt="image" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Using-WSL-and-Lets-Encrypt-to-create-Azu_C384/image_3d6c1eb8-4a3e-4004-985a-75e8f8f56118.png" width="522" height="437"&gt;&lt;/p&gt;
  9. &lt;p&gt;Next step is to make this even more automatic or select a more automated solution but for now, I'll worry about this in September and it solved my expensive Wildcard Domain issue.&lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/using-wsl-and-lets-encrypt-to-create-azure-app-service-ssl-wildcard-certificates/comments#comments-start</comments><category>Azure</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/aa1cc05f-3910-471d-8686-68c749ec90ff</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/aa1cc05f-3910-471d-8686-68c749ec90ff</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/github-copilot-for-cli-for-powershell/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/aa1cc05f-3910-471d-8686-68c749ec90ff</wfw:commentRss><slash:comments>6</slash:comments><title>GitHub Copilot for CLI for PowerShell</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/aa1cc05f-3910-471d-8686-68c749ec90ff</guid><link>https://www.hanselman.com/blog/github-copilot-for-cli-for-powershell</link><pubDate>Tue, 25 Apr 2023 15:31:49 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;GitHub Next has this cool project that is basically Copilot for the CLI (command line interface). You can sign up for their waitlist at the &lt;a href="https://githubnext.com/projects/copilot-cli/"&gt;Copilot for CLI site&lt;/a&gt;.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Copilot for CLI provides three shell commands: &lt;code&gt;??&lt;/code&gt;, &lt;code&gt;git?&lt;/code&gt; and &lt;code&gt;gh?&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;This is cool and all, but I use PowerShell. Turns out these ?? commands are just router commands to a larger EXE called github-copilot-cli. So if you go "?? something" you're really going "github-copilot-cli what-the-shell something."&lt;/p&gt; &lt;p&gt;So this means I should be able to to do the same/similar aliases for my PowerShell prompt AND change the injected prompt (look at me I'm a prompt engineer) to add 'use powershell to.' &lt;/p&gt; &lt;p&gt;Now it's not perfect, but hopefully it will make the point to the Copilot CLI team that PowerShell needs love also.&lt;/p&gt; &lt;p&gt;Here are my aliases. Feel free to suggest if these suck. Note the addition of "user powershell to" for the ?? one. I may make a ?? and a p? where one does bash and one does PowerShell. I could also have it use wsl.exe and shell out to bash. Lots of possibilities.&lt;/p&gt;&lt;pre class="brush: ps; gutter: false; toolbar: false; collapse: false; smart-tabs: false;"&gt;function ?? { &lt;br&gt;    $TmpFile = New-TemporaryFile &lt;br&gt;    github-copilot-cli what-the-shell ('use powershell to ' + $args) --shellout $TmpFile &lt;br&gt;    if ([System.IO.File]::Exists($TmpFile)) { &lt;br&gt;        $TmpFileContents = Get-Content $TmpFile &lt;br&gt;            if ($TmpFileContents -ne $nill) {&lt;br&gt;            Invoke-Expression $TmpFileContents &lt;br&gt;            Remove-Item $TmpFile &lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;br&gt;function git? {&lt;br&gt;    $TmpFile = New-TemporaryFile&lt;br&gt;    github-copilot-cli git-assist $args --shellout $TmpFile&lt;br&gt;    if ([System.IO.File]::Exists($TmpFile)) {&lt;br&gt;        $TmpFileContents = Get-Content $TmpFile &lt;br&gt;            if ($TmpFileContents -ne $nill) {&lt;br&gt;            Invoke-Expression $TmpFileContents &lt;br&gt;            Remove-Item $TmpFile &lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;function gh? {&lt;br&gt;    $TmpFile = New-TemporaryFile&lt;br&gt;    github-copilot-cli gh-assist $args --shellout $TmpFile&lt;br&gt;    if ([System.IO.File]::Exists($TmpFile)) {&lt;br&gt;        $TmpFileContents = Get-Content $TmpFile &lt;br&gt;            if ($TmpFileContents -ne $nill) {&lt;br&gt;            Invoke-Expression $TmpFileContents &lt;br&gt;            Remove-Item $TmpFile &lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;} &lt;/pre&gt;
  10. &lt;p&gt;It also then offers to run the command. Very smooth.&lt;/p&gt;&lt;figure&gt;&lt;img title="image" style="margin: 0px; display: inline" alt="image" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/GitHub-Copilot-for-CLI-for-PowerShell_B0E3/image_f39afdbf-04bf-4c95-a913-2404f46dc308.png" width="999" height="437"&gt;&lt;/figure&gt;
  11. &lt;p&gt;Hope you like it. Lots of fun stuff happening in this space.&lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/github-copilot-for-cli-for-powershell/comments#comments-start</comments><category>AI</category><category>PowerShell</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/0c9c9a66-f3db-4e58-a1f3-c692b8ad64af</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/0c9c9a66-f3db-4e58-a1f3-c692b8ad64af</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/use-your-own-user-domain-for-mastodon-discoverability-with-the-webfinger-protocol-without-hosting-a-server/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/0c9c9a66-f3db-4e58-a1f3-c692b8ad64af</wfw:commentRss><slash:comments>3</slash:comments><title>Use your own user @ domain for Mastodon discoverability with the WebFinger Protocol without hosting a server</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/0c9c9a66-f3db-4e58-a1f3-c692b8ad64af</guid><link>https://www.hanselman.com/blog/use-your-own-user-domain-for-mastodon-discoverability-with-the-webfinger-protocol-without-hosting-a-server</link><pubDate>Sun, 18 Dec 2022 22:16:30 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;Mastodon is a free, open-source social networking service that is decentralized and distributed. It was created in 2016 as an alternative to centralized social media platforms such as Twitter and Facebook. &lt;p&gt;One of the key features of Mastodon is the use of the WebFinger protocol, which allows users to discover and access information about other users on the Mastodon network. WebFinger is a simple HTTP-based protocol that enables a user to discover information about other users or resources on the internet by using their email address or other identifying information. The WebFinger protocol is important for Mastodon because it enables users to find and follow each other on the network, regardless of where they are hosted. &lt;p&gt;WebFinger uses a "well known" path structure when calling an domain. You may be familiar with the robots.txt convention. We all just agree that robots.txt will sit at the top path of everyone's domain. &lt;p&gt;The WebFinger protocol is a simple HTTP-based protocol that enables a user or search to discover information about other users or resources on the internet by using their email address or other identifying information. My is first name at last name .com, so...my personal WebFinger API endpoint is here &lt;a title="https://www.hanselman.com/.well-known/webfinger" href="https://www.hanselman.com/.well-known/webfinger"&gt;https://www.hanselman.com/.well-known/webfinger&lt;/a&gt; &lt;p&gt;The idea is that... &lt;ol&gt; &lt;li&gt; &lt;p&gt;A user sends a WebFinger request to a server, using the email address or other identifying information of the user or resource they are trying to discover.&lt;/p&gt; &lt;li&gt; &lt;p&gt;The server looks up the requested information in its database and returns a JSON object containing the information about the user or resource. This JSON object is called a "resource descriptor."&lt;/p&gt; &lt;li&gt; &lt;p&gt;The user's client receives the resource descriptor and displays the information to the user.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;The resource descriptor contains various types of information about the user or resource, such as their name, profile picture, and links to their social media accounts or other online resources. It can also include other types of information, such as the user's public key, which can be used to establish a secure connection with the user. &lt;p&gt;There's &lt;a href="https://guide.toot.as/guide/use-your-own-domain/"&gt;a great explainer here as well&lt;/a&gt;. From that page: &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;When someone searches for you on Mastodon, your server will be queried for accounts using an endpoint that looks like this:&lt;/strong&gt; &lt;p&gt;GET &lt;a href="https://${MASTODON_DOMAIN}/.well-known/webfinger?resource=acct:${MASTODON_USER}@${MASTODON_DOMAIN"&gt;https://${MASTODON_DOMAIN}/.well-known/webfinger?resource=acct:${MASTODON_USER}@${MASTODON_DOMAIN&lt;/a&gt;}&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Note that Mastodon user names start with @ so they are @username@someserver.com. Just like twiter would be @shanselman@twitter.com I can be @shanselman@hanselman.com now! &lt;p&gt;&lt;img title="Searching for me with Mastodon" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Searching for me with Mastodon" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/f76e92f681b3_FC6E/image_cb60bf43-6d0a-41f9-9ff5-246f288adedf.png" width="533" height="455"&gt; &lt;p&gt;So perhaps &lt;em&gt;https://www.hanselman.com/.well-known/webfinger?resource=acct:FRED@HANSELMAN.COM&lt;/em&gt; &lt;p&gt;Mine returns&lt;pre class="brush: js; gutter: false; toolbar: false; auto-links: false; smart-tabs: false;"&gt;{&lt;br&gt;    "subject":"acct:shanselman@hachyderm.io",&lt;br&gt;    "aliases":&lt;br&gt;    [&lt;br&gt;        "https://hachyderm.io/@shanselman",&lt;br&gt;        "https://hachyderm.io/users/shanselman"&lt;br&gt;    ],&lt;br&gt;    "links":&lt;br&gt;    [&lt;br&gt;        {&lt;br&gt;            "rel":"http://webfinger.net/rel/profile-page",&lt;br&gt;            "type":"text/html",&lt;br&gt;            "href":"https://hachyderm.io/@shanselman"&lt;br&gt;        },&lt;br&gt;        {&lt;br&gt;            "rel":"self",&lt;br&gt;            "type":"application/activity+json",&lt;br&gt;            "href":"https://hachyderm.io/users/shanselman"&lt;br&gt;        },&lt;br&gt;        {&lt;br&gt;            "rel":"http://ostatus.org/schema/1.0/subscribe",&lt;br&gt;            "template":"https://hachyderm.io/authorize_interaction?uri={uri}"&lt;br&gt;        }&lt;br&gt;    ]&lt;br&gt;}
  12. &lt;/pre&gt;
  13. &lt;p&gt;This file should be returned as a mime type of &lt;strong&gt;application/jrd+json&lt;/strong&gt;
  14. &lt;p&gt;My site is an ASP.NET Razor Pages site, so I just did this in Startup.cs to map that well known URL to a page/route that returns the JSON needed.&lt;pre class="brush: csharp; gutter: false; toolbar: false; auto-links: false; smart-tabs: false;"&gt;services.AddRazorPages().AddRazorPagesOptions(options =&amp;gt;&lt;br&gt;{&lt;br&gt;    options.Conventions.AddPageRoute("/robotstxt", "/Robots.Txt"); //i did this before, not needed&lt;br&gt;    options.Conventions.AddPageRoute("/webfinger", "/.well-known/webfinger");&lt;br&gt;    options.Conventions.AddPageRoute("/webfinger", "/.well-known/webfinger/{val?}");&lt;br&gt;});
  15. &lt;/pre&gt;
  16. &lt;p&gt;then I made a webfinger.cshtml like this. Note I have to double escape the @@ sites because it's Razor.&lt;pre class="brush: xml; gutter: false; toolbar: false; auto-links: false; smart-tabs: false;"&gt;@page&lt;br&gt;@{&lt;br&gt;    Layout = null;&lt;br&gt;    this.Response.ContentType = "application/jrd+json";&lt;br&gt;}&lt;br&gt;{&lt;br&gt;    "subject":"acct:shanselman@hachyderm.io",&lt;br&gt;    "aliases":&lt;br&gt;    [&lt;br&gt;        "https://hachyderm.io/@@shanselman",&lt;br&gt;        "https://hachyderm.io/users/shanselman"&lt;br&gt;    ],&lt;br&gt;    "links":&lt;br&gt;    [&lt;br&gt;        {&lt;br&gt;            "rel":"http://webfinger.net/rel/profile-page",&lt;br&gt;            "type":"text/html",&lt;br&gt;            "href":"https://hachyderm.io/@@shanselman"&lt;br&gt;        },&lt;br&gt;        {&lt;br&gt;            "rel":"self",&lt;br&gt;            "type":"application/activity+json",&lt;br&gt;            "href":"https://hachyderm.io/users/shanselman"&lt;br&gt;        },&lt;br&gt;        {&lt;br&gt;            "rel":"http://ostatus.org/schema/1.0/subscribe",&lt;br&gt;            "template":"https://hachyderm.io/authorize_interaction?uri={uri}"&lt;br&gt;        }&lt;br&gt;    ]&lt;br&gt;}
  17. &lt;/pre&gt;
  18. &lt;p&gt;This is a static response, but if I was hosting pages for more than one person I'd want to take in the url with the user's name, and then map it to their aliases and return those correctly.
  19. &lt;p&gt;Even easier, you can just use the JSON file of your own Mastodon server's webfinger response and SAVE IT as a static json file and copy it to your own server!
  20. &lt;p&gt;As long as your server returns the right JSON from that well known URL then it'll work.
  21. &lt;p&gt;So this is &lt;em&gt;my &lt;/em&gt;template &lt;a title="https://hachyderm.io/.well-known/webfinger?resource=acct:shanselman@hachyderm.io" href="https://hachyderm.io/.well-known/webfinger?resource=acct:shanselman@hachyderm.io"&gt;https://hachyderm.io/.well-known/webfinger?resource=acct:shanselman@hachyderm.io&lt;/a&gt; from where I'm hosted now.
  22. &lt;p&gt;If you want to get started with Mastodon, start here. &lt;a title="https://github.com/joyeusenoelle/GuideToMastodon/" href="https://github.com/joyeusenoelle/GuideToMastodon/"&gt;https://github.com/joyeusenoelle/GuideToMastodon/&lt;/a&gt; it feels like Twitter circa 2007 except it's not owned by anyone and is based on web standards like ActivityPub.
  23. &lt;p&gt;Hope this helps! &lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/use-your-own-user-domain-for-mastodon-discoverability-with-the-webfinger-protocol-without-hosting-a-server/comments#comments-start</comments><category>Musings</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/aba7f282-e752-48e8-8bf5-3c2e8c33c0e6</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/aba7f282-e752-48e8-8bf5-3c2e8c33c0e6</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/i-got-tired/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/aba7f282-e752-48e8-8bf5-3c2e8c33c0e6</wfw:commentRss><slash:comments>31</slash:comments><title>I got tired</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/aba7f282-e752-48e8-8bf5-3c2e8c33c0e6</guid><link>https://www.hanselman.com/blog/i-got-tired</link><pubDate>Sun, 18 Dec 2022 18:27:11 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;&lt;a href="https://unsplash.com/photos/bmJAXAz6ads"&gt;&lt;img title="I got tired - photo by Elisa Ventur" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: right; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 4px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="I got tired - photo by Elisa Ventur" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/I-got-tired-and-I-took-a-break_C67F/tired_299ef159-a454-413b-8654-3ec136cf9f79.jpg" width="350" align="right" height="233"&gt;&lt;/a&gt;I have been blogging here for the last 20 years. Every Tuesday and Thursday, quite consistently, for two decades. But last year, without planning it, I got tired and stopped. Not sure why. It didn't correspond with any life events. Nothing interesting or notable happened. I just stopped.&lt;/p&gt; &lt;p&gt;I did find joy on &lt;a href="https://www.tiktok.com/@shanselman"&gt;TikTok&lt;/a&gt; and amassed a small group of like-minded followers there. I enjoy my &lt;a href="https://www.youtube.com/shanselman"&gt;YouTube&lt;/a&gt; as well, and my &lt;a href="https://www.hanselminutes.com/episodes"&gt;weekly podcast&lt;/a&gt; is going strong with nearly 900 (!) episodes of interviews with cool people. I've also recently &lt;a href="https://hachyderm.io/@shanselman"&gt;started posting on Mastodon&lt;/a&gt; (a fediverse (federated universe)) Twitter alternative that uses the &lt;a href="https://activitypub.rocks/"&gt;ActivityPub web standard&lt;/a&gt;. I see that &lt;a href="https://github.com/poppastring/dasblog-core/issues/647"&gt;Mark Downie has been looking at ActivityPub as well for DasBlog&lt;/a&gt; (the blog engine that powers this blog) so I need to spend sometime with Mark soon.&lt;/p&gt; &lt;p&gt;Being consistent is a hard thing, and I think I did a good job. I gave many talks over many years about &lt;a href="https://www.hanselman.com/blog/scott-hanselmans-complete-list-of-productivity-tips"&gt;Personal Productivity&lt;/a&gt; but I always mentioned doing what "feeds your spirit." For a minute here the blog took a backseat, and that's OK. I filled that (spare) time with family time, personal projects, writing more code, 3d printing, games, taekwondo, and a ton of other things. &lt;/p&gt; &lt;p&gt;Going forward I will continue to write and share across a number of platforms, but it will continue to &lt;a href="https://www.hanselman.com/blog/your-blog-is-the-engine-of-community"&gt;start here&lt;/a&gt; as &lt;a href="https://www.hanselman.com/blog/your-words-are-wasted"&gt;it's super important to Own Your Words&lt;/a&gt;. Keep taking snapshots and backups of your keystrokes as you never know when your chosen platform might change or go away entirely.&lt;/p&gt; &lt;p&gt;I'm still here. I hope you are too! I will see you soon.&lt;/p&gt; &lt;h3&gt;Related Links:&lt;/h3&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="https://www.hanselman.com/blog/do-they-deserve-the-gift-of-your-keystrokes"&gt;Do they deserve the gift of your keystrokes?&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="https://www.hanselman.com/blog/do-you-have-a-digital-or-social-media-will-who-will-maintain-your-life-online-when-youre-dead"&gt;Do you have a digital or social media will?&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/i-got-tired/comments#comments-start</comments><category>Musings</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/9632ddf9-403c-4319-bba6-4cb98bc7932b</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/9632ddf9-403c-4319-bba6-4cb98bc7932b</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/using-home-assistant-to-integrate-a-unifi-protect-g4-doorbell-and-amazon-alexa-to-announce-visitors/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/9632ddf9-403c-4319-bba6-4cb98bc7932b</wfw:commentRss><title>Using Home Assistant to integrate a Unifi Protect G4 Doorbell and Amazon Alexa to announce visitors</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/9632ddf9-403c-4319-bba6-4cb98bc7932b</guid><link>https://www.hanselman.com/blog/using-home-assistant-to-integrate-a-unifi-protect-g4-doorbell-and-amazon-alexa-to-announce-visitors</link><pubDate>Tue, 14 Dec 2021 21:36:00 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;I am not a &lt;a href="https://www.home-assistant.io/"&gt;Home Assistant&lt;/a&gt; expert, but it's clearly a massive and powerful ecosystem. I've interviewed &lt;a href="https://hanselminutes.com/788/automating-all-the-things-with-home-assistants-paulus-schoutsen"&gt;the creator of Home Assistant on my podcast&lt;/a&gt; and I encourage you to check out that chat.&lt;/p&gt; &lt;p&gt;Home Assistant can quickly become a hobby that overwhelms you. Every object (entity) in your house that is even remotely connected can become programmable. Everything. Even people! You can declare that any name:value pair that (for example) your phone can expose can be consumable by Home Assistant. Questions like "is Scott home" or "what's Scott's phone battery" can be associated with Scott the Entity in the Home Assistant Dashboard. &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;I was amazed at the devices/objects that Home Assistant discovered that it could automate. Lights, remotes, Spotify, and more. You'll find that any internally connected device you have likely has an Integration available.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Temperature, Light Status, sure, that's easy Home Automation. But integrations and 3rd party code can give you details like "Is the Living Room dark" or "is there motion in the driveway." From these building blocks, you can then build your own IFTTT (If This Then That) automations, combining not just two systems, but any and all disparate systems.&lt;/p&gt; &lt;p&gt;What's the best part? This all runs LOCALLY. Not in a cloud or the cloud or anyone's cloud. I've got my stuff running on a &lt;a href="https://amzn.to/3HnJ3IY"&gt;Raspberry Pi 4&lt;/a&gt;. Even better I put a &lt;a href="https://amzn.to/3HnJ3IY"&gt;Power Over Ethernet (PoE) hat on my Rpi&lt;/a&gt; so I have just one network wire into my hub that powers the Pi.&lt;/p&gt; &lt;p&gt;I believe setting up &lt;a href="https://www.home-assistant.io/installation/raspberrypi/"&gt;Home Assistant on a Pi&lt;/a&gt; is the best and easiest way to get started. That said, you can also run in a Docker Container, on a Synology or other NAS, or just on Windows or Mac in the background. It's up to you. Optionally, you can pay &lt;a href="https://www.nabucasa.com/"&gt;Nabu Casa&lt;/a&gt; $5 for remote (outside your house) network access via transparent forwarding. But to be clear, it all still runs inside your house and not in the cloud.&lt;/p&gt; &lt;p&gt;&lt;img title="Basic Home Assistant Setup" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Basic Home Assistant Setup" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Using-Home-Assistant_E31C/image_c613af81-10de-49d3-aead-6e174ca870ca.png" width="600" height="550"&gt;&lt;/p&gt; &lt;p&gt;OK, to the main point. I used to have an Amazon Ring Doorbell that would integrate with Amazon Alexa and when you pressed the doorbell it would say "Someone is at the front door" on our all Alexas. It was a lovely little integration that worked nicely in our lives.&lt;/p&gt; &lt;p&gt;&lt;img title="Front Door UniFi G4 Doorbell" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Front Door UniFi G4 Doorbell" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Using-Home-Assistant_E31C/image_165ff623-cdc3-40c0-9caf-46686032f539.png" width="485" height="357"&gt;&lt;/p&gt; &lt;p&gt;However, I swapped out the Ring for a &lt;a href="https://hacs.xyz/"&gt;Unifi Protect G4 Doorbell&lt;/a&gt; for a number of reasons. I don't want to pump video to outside services, so this doorbell integrates nicely with my &lt;a href="https://www.hanselman.com/blog/review-unifi-from-ubiquiti-networking-is-the-ultimate-prosumer-home-networking-solution"&gt;existing Unifi installation&lt;/a&gt; and records video to a local hard drive. However, I lose any Alexa integration and this nice little "someone is at the door" announcement. So this seems like a perfect job for Home Assistant.&lt;/p&gt; &lt;p&gt;Here's the general todo list:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Install &lt;a href="https://www.home-assistant.io/getting-started/"&gt;Home Assistant&lt;/a&gt;&lt;/li&gt; &lt;li&gt;Install &lt;a href="https://hacs.xyz/"&gt;Home Assistant Community Store&lt;/a&gt;&lt;/li&gt; &lt;ul&gt; &lt;li&gt;This enables 3rd party "untrusted" integrations directly from GitHub. You'll need a GitHub account and it'll clone custom integrations directly into your local HA.&lt;/li&gt; &lt;li&gt;I also recommend the Terminal &amp;amp; SSH (9.2.2), File editor (5.3.3) add ons so you can see what's happening.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Get the &lt;a href="https://github.com/briis/unifiprotect"&gt;UniFi Protect 3rd party integration for Home Assistant&lt;/a&gt;&lt;/li&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Unifi Protect support is being promoted in Home Assistant v2022.2 so you won't need this step soon as it'll be included.&lt;/li&gt; &lt;li&gt;"The UniFi Protect Integration adds support for retrieving Camera feeds and Sensor data from a UniFi Protect installation on either an Ubiquiti CloudKey+, Ubiquiti UniFi Dream Machine Pro or UniFi Protect Network Video Recorder."&lt;/li&gt; &lt;li&gt;Authenticate and configure this integration.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Get the &lt;a href="https://github.com/custom-components/alexa_media_player"&gt;Alexa Media Player&lt;/a&gt; integration&lt;/li&gt; &lt;ul&gt; &lt;li&gt;This makes all your Alexas show up in Home Assistant as "media players" and also allows you to tts (text to speech) to them.&lt;/li&gt; &lt;li&gt;Authenticate and configure this integration.&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt; &lt;p&gt;I recommend going into your Alexa app and making a Multi-room Speaker Group called "everywhere." Not only because it's nice to be able to say "play the music everywhere" but you can also target that "Everywhere" group in Home Assistant.&lt;/p&gt; &lt;p&gt;Go into your Home Assistant UI at &lt;a title="http://homeassistant.local:8123/" href="http://homeassistant.local:8123/"&gt;http://homeassistant.local:8123/&lt;/a&gt; and into &lt;a href="https://www.home-assistant.io/docs/tools/dev-tools/"&gt;Developer Tools&lt;/a&gt;. Under Services, try pasting in this YAML and clicking "call service."&lt;/p&gt;&lt;pre&gt;service: notify.alexa_media_everywhere
  24. data:
  25.  message: Someone is at the front door, this is a test
  26.  data:
  27.    type: announce
  28.    method: speak&lt;/pre&gt;
  29. &lt;p&gt;If that works, you know you can automate Alexa and make it say things. Now, go to Configuration, Automation, and Add a new Automation. Here's mine. I used the UI to create it. Note that your Entity names may be different if you give your front doorbell camera a different name.&lt;/p&gt;
  30. &lt;p&gt;&lt;img title="Binary_sensor.front_door_doorbell" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Binary_sensor.front_door_doorbell" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Using-Home-Assistant_E31C/image_6c40ad44-b67e-422c-97c8-41741af21066.png" width="404" height="389"&gt;&lt;/p&gt;
  31. &lt;p&gt;Notice the format of Data, it's name value pairs within a single field's value.&lt;/p&gt;
  32. &lt;p&gt;&lt;img title="Alexa Action" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Alexa Action" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Using-Home-Assistant_E31C/image_5a58a5af-dd88-40f5-9c62-93202dbdf409.png" width="815" height="682"&gt;&lt;/p&gt;
  33. &lt;p&gt;...but it also exists in a file called Automations.yaml. Note that the "to: 'on'" trigger is required or you'll get double announcements, one for &lt;em&gt;each state change &lt;/em&gt;in the doorbell. &lt;/p&gt;&lt;pre&gt;- id: '1640995128073'
  34.  alias: G4 Doorbell Announcement with Alexa
  35.  description: G4 Doorbell Announcement with Alexa
  36.  trigger:
  37.  - platform: state
  38.    entity_id: binary_sensor.front_door_doorbell
  39.    to: 'on'
  40.  condition: []
  41.  action:
  42.  - service: notify.alexa_media_everywhere
  43.    data:
  44.      data:
  45.        type: announce
  46.        method: speak
  47.      message: Someone is at the front door
  48.  mode: single&lt;/pre&gt;
  49. &lt;p&gt;It works! There's a ton of cool stuff I can automate now!&lt;/p&gt;
  50. &lt;hr&gt;
  51.  
  52. &lt;p&gt;&lt;strong&gt;Sponsor:&lt;/strong&gt; Make login Auth0’s problem. Not yours. Provide the convenient login features your customers want, like social login, multi-factor authentication, single sign-on, passwordless, and more. &lt;a href="https://hnsl.mn/34dSTyP"&gt;Get started for free.&lt;/a&gt;&lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/using-home-assistant-to-integrate-a-unifi-protect-g4-doorbell-and-amazon-alexa-to-announce-visitors/comments#comments-start</comments><category>Home Server</category><category>Musings</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/0909e949-cd9a-4867-8e02-6e24660b1856</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/0909e949-cd9a-4867-8e02-6e24660b1856</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/javascript-and-typescript-projects-with-react-angular-or-vue-in-visual-studio-2022-with-or-without-net/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/0909e949-cd9a-4867-8e02-6e24660b1856</wfw:commentRss><slash:comments>1</slash:comments><title>JavaScript and TypeScript Projects with React, Angular, or Vue in Visual Studio 2022 with or without .NET</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/0909e949-cd9a-4867-8e02-6e24660b1856</guid><link>https://www.hanselman.com/blog/javascript-and-typescript-projects-with-react-angular-or-vue-in-visual-studio-2022-with-or-without-net</link><pubDate>Thu, 25 Nov 2021 20:50:00 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;I was reading &lt;a href="https://devblogs.microsoft.com/visualstudio/the-new-javascript-typescript-experience-in-vs-2022-preview-3/"&gt;Gabby's blog post about the new TypeScript/JavaScript project experience in Visual Studio 2022&lt;/a&gt;. You should read the docs on &lt;a href="https://docs.microsoft.com/en-us/visualstudio/javascript/javascript-in-vs-2022?view=vs-2022"&gt;JavaScript and TypeScript in Visual Studio 2022&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;If you're used to ASP.NET apps when you think about apps that are JavaScript heavy, "front end apps" or TypeScript focused, it can be confusing as to "where does .NET fit in?"&lt;/p&gt; &lt;p&gt;You need to consider the responsibilities of your various projects or subsystems and the multiple totally valid ways you can build a web site or web app. Let's consider just a few:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/visualstudio/javascript/tutorial-aspnet-with-typescript?view=vs-2022"&gt;An ASP.NET Web app that renders HTML on the server but uses TS/JS&lt;/a&gt;  &lt;ul&gt; &lt;li&gt;This may have a Web API, Razor Pages, with or without the MVC pattern.  &lt;li&gt;You maybe have just added JavaScript via &amp;lt;script&amp;gt; tags  &lt;li&gt;Maybe you added a script minimizer/minifier task  &lt;li&gt;Can be confusing because it can feel like your app needs to 'build both the client and the server' from one project&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;A mostly JavaScript/TypeScript frontend app where the HTML could be served from any web server (node, kestrel, static web apps, nginx, etc)  &lt;ul&gt; &lt;li&gt;This app may use Vue or React or Angular but it's not an "ASP.NET app"  &lt;li&gt;It calls backend Web APIs that may be served by ASP.NET, Azure Functions, 3rd party REST APIs, or all of the above  &lt;li&gt;This scenario has sometimes been confusing for ASP.NET developers who may get confused about responsibility. Who builds what, where do things end up, how do I build and deploy this?&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/visualstudio/javascript/javascript-in-vs-2022?view=vs-2022"&gt;VS2022&lt;/a&gt; brings JavaScript and TypeScript support into VS with a full JavaScript Language Service based on TS. It provides a TypeScript NuGet Package so you can build your whole app with MSBuild and VS will do the right thing.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;NEW: &lt;/strong&gt;Starting in Visual Studio 2022, there is a new JavaScript/TypeScript project type (.esproj) that allows you to create standalone Angular, React, and Vue projects in Visual Studio.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;The .esproj concept is great for folks familiar with Visual Studio as we know that a Solution contains one or more Projects. Visual Studio manages files for a single application in a &lt;em&gt;Project&lt;/em&gt;. The project includes source code, resources, and configuration files. In this case we can have a .csproj for a backend Web API and an .esproj that uses a client side template like Angular, React, or Vue.&lt;/p&gt; &lt;p&gt;Thing is, historically when Visual Studio supported Angular, React, or Vue, it's templates were out of date and not updated enough. VS2022 uses the native CLIs for these front ends, solving that problem with &lt;a href="https://angular.io/cli"&gt;Angular CLI&lt;/a&gt;, &lt;a href="https://github.com/facebook/create-react-app"&gt;Create React App&lt;/a&gt;, and &lt;a href="https://cli.vuejs.org/"&gt;Vue CLI&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;If I am in VS and go "File New Project" there are Standalone templates that solve Example 2 above. I'll pick JavaScript React.&lt;/p&gt; &lt;p&gt;&lt;img title="Standalone JavaScript Templates in VS2022" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Standalone JavaScript Templates in VS2022" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/97390fb5b7df_12523/image_8fbe4808-d001-4208-a77c-614f8ed4126d.png" width="567" height="610"&gt;&lt;/p&gt; &lt;p&gt;Then I'll click "Add integration for Empty ASP.NET Web API. This will give me a frontend with javascript ready to call a ASP.NET Web API backend. I'll &lt;a href="https://docs.microsoft.com/en-us/visualstudio/javascript/tutorial-asp-net-core-with-react?view=vs-2022"&gt;follow along here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&lt;img title="Standalone JavaScript React Template" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Standalone JavaScript React Template" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/97390fb5b7df_12523/image_bc274b03-19f1-4f1f-8fb8-f9d2f9dce344.png" width="467" height="119"&gt;&lt;/p&gt; &lt;p&gt;It then uses the React CLI to make the front end, which again, is cool as it's whatever version I want it to be.&lt;/p&gt; &lt;p&gt;&lt;img title="React Create CLI" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="React Create CLI" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/97390fb5b7df_12523/image_3b618c5d-75cd-4dc3-b9c6-78be33dbe019.png" width="600" height="133"&gt;&lt;/p&gt; &lt;p&gt;Then I'll add my ASP.NET Web API backend to the same solution, so now I have an esproj and a csproj like this&lt;/p&gt; &lt;p&gt;&lt;img title="frontend and backend" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="frontend and backend" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/97390fb5b7df_12523/image_ecdd0c10-39eb-4eb9-aa87-6d9c712d362f.png" width="221" height="330"&gt;&lt;/p&gt; &lt;p&gt;Now I have a nice clean two project system - in this case more JavaScript focused than .NET focused. This one uses npm to startup the project using their web development server and proxyMiddleware to proxy localhost:3000 calls over to the ASP.NET Web API project. &lt;/p&gt; &lt;p&gt;Here is a React app served by npm calling over to the Weather service served from Kestrel on ASP.NET.&lt;/p&gt; &lt;figure&gt;&lt;img title="npm app running in VS 2022 against an ASP.NET Web API" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="npm app running in VS 2022 against an ASP.NET Web API" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/97390fb5b7df_12523/image_5d1af2f4-4754-4aa8-9e24-8ab9fa23a01c.png" width="915" height="986"&gt;&lt;/figure&gt;&lt;p&gt;This is inverted than most ASP.NET Folks are used to, and that's OK. This shows me that Visual Studio 2022 can support either development style, use the CLI that is installed for whatever Frontend Framework, and allow me to choose what web server and web browser (via Launch.json) I want.&lt;/p&gt; &lt;p&gt;If you want to flip it, and &lt;a href="https://docs.microsoft.com/en-us/visualstudio/javascript/tutorial-aspnet-with-typescript?view=vs-2022"&gt;put ASP.NET Core as the primary and then bring in some TypeScript/JavaScript, follow this tutorial because&lt;/a&gt; that's also possible!&lt;/p&gt; &lt;hr&gt;  &lt;p&gt;&lt;strong&gt;Sponsor: &lt;/strong&gt;Make login Auth0’s problem. Not yours. Provide the convenient login features your customers want, like social login, multi-factor authentication, single sign-on, passwordless, and more. &lt;a href="http://pubads.g.doubleclick.net/gampad/clk?id=5840349572&amp;amp;iu=/6839/lqm.scotthanselman.site"&gt;Get started for free.&lt;/a&gt;&lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/javascript-and-typescript-projects-with-react-angular-or-vue-in-visual-studio-2022-with-or-without-net/comments#comments-start</comments><category>ASP.NET</category><category>Javascript</category><category>Web Services</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/495513ca-ca88-421f-8ade-50e4cf17d747</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/495513ca-ca88-421f-8ade-50e4cf17d747</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/a-nightscout-segment-for-ohmyposh-shows-my-realtime-blood-sugar-readings-in-my-git-prompt/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/495513ca-ca88-421f-8ade-50e4cf17d747</wfw:commentRss><slash:comments>3</slash:comments><title>A Nightscout Segment for OhMyPosh shows my realtime Blood Sugar readings in my Git Prompt</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/495513ca-ca88-421f-8ade-50e4cf17d747</guid><link>https://www.hanselman.com/blog/a-nightscout-segment-for-ohmyposh-shows-my-realtime-blood-sugar-readings-in-my-git-prompt</link><pubDate>Tue, 23 Nov 2021 20:02:00 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;I've talked about &lt;a href="https://www.hanselman.com/blog/my-ultimate-powershell-prompt-with-oh-my-posh-and-the-windows-terminal"&gt;how I love a nice pretty prompt in my Windows Terminal&lt;/a&gt; and &lt;a href="https://www.youtube.com/watch?v=VT2L1SXFq9U"&gt;made videos showing in detail how to do it&lt;/a&gt;. I've also worked with my buddy &lt;a href="https://www.hanselman.com/blog/visualizing-your-realtime-blood-sugar-values-and-a-git-prompt-on-windows-powershell-and-linux-bash"&gt;TooTallNate to put my real-time blood sugar into a bash or PowerShell prompt&lt;/a&gt;, but this was back in 2017.&lt;/p&gt; &lt;p&gt;Now that I'm "Team &lt;a href="https://ohmyposh.dev/"&gt;OhMyPosh&lt;/a&gt;" I have been meaning to write a Nightscout "segment" for my prompt. &lt;a href="https://www.nightscoutfoundation.org/how-you-can-help"&gt;Nightscout&lt;/a&gt; is an open source self-hosted (there are &lt;a href="https://www.t1pal.com/"&gt;commercial hosts also like T1Pal&lt;/a&gt;) website and API for remote display of real-time and near-real-time glucose readings for Diabetics like myself.&lt;/p&gt; &lt;p&gt;Since my body has an active REST API where I can just do an HTTP GET (via curl or whatever) and see my blood sugar, it clearly belongs in a place of honor, just like my current Git Branch! &lt;/p&gt; &lt;figure&gt;&lt;img title="My blood sugar in my Prompt!" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="My blood sugar in my Prompt!" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/a1ea1c6a57b0_119D3/image_d14e0906-8932-44e0-a493-86eeac62c1ae.png" width="999" height="37"&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="https://ohmyposh.dev/docs/"&gt;Oh My Posh supports configurable "segments"&lt;/a&gt; and now there's a beta (still needs mmol and stale readings support) &lt;a href="https://ohmyposh.dev/docs/nightscout"&gt;Nightscout segment&lt;/a&gt; that you can setup in just a few minutes! &lt;/figure&gt; &lt;p&gt;This prompt works in ANY shell on ANY os! You can do this in zsh, PowerShell, Bash, whatever makes you happy.&lt;/p&gt; &lt;p&gt;Here is a YouTube of Jan from OhMyPosh and I coding the segment LIVE in Go.&lt;/p&gt; &lt;center&gt; &lt;div class="embed-container"&gt;&lt;iframe title="YouTube video player" height="315" src="https://www.youtube.com/embed/_meKUIm9NwA" frameborder="0" width="560" allowfullscreen allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/center&gt; &lt;p&gt;If you have an existing OhMyPosh json config, you can just add another segment like this. Make sure your Nightscout URL includes a secure Token or is public (up to you). Note also that I setup "if/then" rules in my background_templates. These are optional and up to you to change to your taste. I set my background colors to red, yellow, green depending on sugar numbers. I also have a foreground template that is not really used, as you can see it always evaluates to black #000, but it shows you how you could set it to white text on a darker background if you wanted. &lt;/p&gt;&lt;pre class="brush: js; gutter: false; toolbar: false; auto-links: false; smart-tabs: false;"&gt;{&lt;br&gt;  "type": "nightscout",&lt;br&gt;  "style": "diamond",&lt;br&gt;  "foreground": "#ffffff",&lt;br&gt;  "background": "#ff0000",&lt;br&gt;  "background_templates": [&lt;br&gt;    "{{ if gt .Sgv 150 }}#FFFF00{{ end }}",&lt;br&gt;    "{{ if lt .Sgv 60 }}#FF0000{{ end }}",&lt;br&gt;    "#00FF00"&lt;br&gt;  ],&lt;br&gt;  "foreground_templates": [&lt;br&gt;    "{{ if gt .Sgv 150 }}#000000{{ end }}",&lt;br&gt;    "{{ if lt .Sgv 60 }}#000000{{ end }}",&lt;br&gt;    "#000000"&lt;br&gt;  ],&lt;br&gt;&lt;br&gt;  "leading_diamond": "",&lt;br&gt;  "trailing_diamond": "\uE0B0",&lt;br&gt;  "properties": {&lt;br&gt;    "url": "https://YOURNIGHTSCOUTAPP.herokuapp.com/api/v1/entries.json?count=1&amp;amp;token=APITOKENFROMYOURADMIN",&lt;br&gt;    "http_timeout": 1500,&lt;br&gt;    "template": " {{.Sgv}}{{.TrendIcon}}"&lt;br&gt;  }&lt;br&gt;},
  53. &lt;/pre&gt;
  54. &lt;p&gt;By default we will only go out and hit your Nightscout instance every 5 min, only when the prompt is repainted, and we'll only wait 1500ms before giving up. You can set that "http_timeout" (how long before we give up) if you feel this slows you down. It'll be cached for 5 min so it's unlikely&amp;nbsp; to b something you'll notice. The benefit of this new OhMyPosh segment over the previous solution is that it requires no additional services/chron jobs and can be setup extremely quickly. Note also that you can customize your template with &lt;a href="https://www.hanselman.com/blog/how-to-make-a-pretty-prompt-in-windows-terminal-with-powerline-nerd-fonts-cascadia-code-wsl-and-ohmyposh"&gt;NerdFonts&lt;/a&gt;. I've included a tiny syringe!&lt;/p&gt;
  55. &lt;figure&gt;&lt;img title="What a lovely prompt with Blood Sugar!" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="What a lovely prompt with Blood Sugar!" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/a1ea1c6a57b0_119D3/image_84db877d-82c9-4d16-8788-e2692ce7a7e9.png" width="999" height="111"&gt;&lt;/figure&gt;
  56. &lt;p&gt;Next I'll hope to improve the segment with mmol support as well as strikeout style for "stale" (over 15 min old) results. You're also welcome to help out by watching &lt;a href="https://www.youtube.com/watch?v=_meKUIm9NwA"&gt;our YouTube&lt;/a&gt; and submitting a PR!
  57. &lt;hr&gt;
  58.  
  59.  
  60. &lt;p&gt;&lt;strong&gt;Sponsor: &lt;/strong&gt;Make login Auth0’s problem. Not yours. Provide the convenient login features your customers want, like social login, multi-factor authentication, single sign-on, passwordless, and more. &lt;a href="http://pubads.g.doubleclick.net/gampad/clk?id=5840349572&amp;amp;iu=/6839/lqm.scotthanselman.site"&gt;Get started for free.&lt;/a&gt;&lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/a-nightscout-segment-for-ohmyposh-shows-my-realtime-blood-sugar-readings-in-my-git-prompt/comments#comments-start</comments><category>Diabetes</category><category>Open Source</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/efee6f41-a33b-4fb4-9af0-6a8df6b9539b</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/efee6f41-a33b-4fb4-9af0-6a8df6b9539b</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/upgrading-a-20-year-old-university-project-to-net-6-with-dotnetupgradeassistant/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/efee6f41-a33b-4fb4-9af0-6a8df6b9539b</wfw:commentRss><slash:comments>7</slash:comments><title>Upgrading a 20 year old University Project to .NET 6 with dotnet-upgrade-assistant</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/efee6f41-a33b-4fb4-9af0-6a8df6b9539b</guid><link>https://www.hanselman.com/blog/upgrading-a-20-year-old-university-project-to-net-6-with-dotnetupgradeassistant</link><pubDate>Thu, 18 Nov 2021 21:18:00 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;I wrote a &lt;a href="https://www.hanselman.com/blog/rescuing-the-tiny-os-in-c"&gt;Tiny Virtual Operating System&lt;/a&gt; for a 300-level OS class in C# for college back in 2001 (?) and later &lt;a href="https://www.hanselman.com/blog/ive-ported-my-tiny-abstract-os-and-cpu-in-c-projectnbspfr"&gt;moved it to VB.NET in 2002&lt;/a&gt;. This is all pre-.NET Core, and on early .NET 1.1 or 2.0 on Windows. I &lt;a href="https://github.com/shanselman/TinyOS"&gt;moved it to GitHub 5 years ago&lt;/a&gt; and &lt;a href="https://www.hanselman.com/blog/porting-a-15-year-old-net-11-virtual-cpu-tiny-operating-system-school-project-to-net-core-20"&gt;ported it to .NET Core 2.0 at the time&lt;/a&gt;. At this point it was 15 years old, so it was cool to see this project running on Windows, Linux, in Docker, and on a Raspberry Pi...a machine that didn't exist when the project was originally written.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;NOTE: &lt;/strong&gt;If the timeline is confusing, I had already been working in industry for years at this point but was still plugging away at my 4 year degree at night. It eventually took 11 years to complete my BS in Software Engineering.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;This evening, as the children slept, I wanted to see if I could run the &lt;a href="https://dotnet.microsoft.com/platform/upgrade-assistant"&gt;.NET Upgrade Assistant&lt;/a&gt; on this now 20 year old app and get it running on .NET 6. &lt;/p&gt; &lt;p&gt;Let's start:&lt;/p&gt;&lt;pre&gt;$ upgrade-assistant upgrade .\TinyOS.sln&lt;br&gt;-----------------------------------------------------------------------------------------------------------------&lt;br&gt;Microsoft .NET Upgrade Assistant v0.3.256001+3c4e05c787f588e940fe73bfa78d7eedfe0190bd&lt;br&gt;&lt;br&gt;We are interested in your feedback! Please use the following link to open a survey: https://aka.ms/DotNetUASurvey&lt;br&gt;-----------------------------------------------------------------------------------------------------------------&lt;br&gt;&lt;br&gt;[22:58:01 INF] Loaded 5 extensions&lt;br&gt;[22:58:02 INF] Using MSBuild from C:\Program Files\dotnet\sdk\6.0.100\&lt;br&gt;[22:58:02 INF] Using Visual Studio install from C:\Program Files\Microsoft Visual Studio\2022\Preview [v17]&lt;br&gt;[22:58:06 INF] Initializing upgrade step Select an entrypoint&lt;br&gt;[22:58:07 INF] Setting entrypoint to only project in solution: C:\Users\scott\TinyOS\src\TinyOSCore\TinyOSCore.csproj&lt;br&gt;[22:58:07 INF] Recommending executable TFM net6.0 because the project builds to an executable&lt;br&gt;[22:58:07 INF] Initializing upgrade step Select project to upgrade&lt;br&gt;[22:58:07 INF] Recommending executable TFM net6.0 because the project builds to an executable&lt;br&gt;[22:58:07 INF] Recommending executable TFM net6.0 because the project builds to an executable&lt;br&gt;[22:58:07 INF] Initializing upgrade step Back up project&lt;/pre&gt;
  61. &lt;p&gt;See how the process is interactive at the command line, with color prompts and a series of dynamic multiple-choice questions?&lt;/p&gt;&lt;figure&gt;&lt;img title="Updating .NET project with the upgrade assistant" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Updating .NET project with the upgrade assistant" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/16297583fa52_12B8A/image_102c9b35-682a-46ed-9bb3-3d313ddda313.png" width="939" height="352"&gt;&lt;/figure&gt;
  62. &lt;p&gt;Interestingly, it builds on the first try, no errors.&lt;/p&gt;
  63. &lt;p&gt;When I manually look at the .csproj I can see some weird version numbers, likely from some not-quite-baked version of .NET Core 2 I used many years ago. My spidey sense says this is wrong, and I'm assuming the upgrade assistant didn't understand it. &lt;/p&gt;&lt;pre class="brush: xml; gutter: false; toolbar: false; auto-links: false; smart-tabs: false;"&gt;    &amp;lt;!-- &amp;lt;PackageReference Include="ILLink.Tasks" Version="0.1.4-preview-906439" /&amp;gt; --&amp;gt;&lt;br&gt;    &amp;lt;PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0-preview2-final" /&amp;gt;&lt;br&gt;    &amp;lt;PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0-preview2-final" /&amp;gt;&lt;br&gt;    &amp;lt;PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0-preview2-final" /&amp;gt;&lt;br&gt;    &amp;lt;PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0-preview2-final" /&amp;gt;
  64. &lt;/pre&gt;
  65. &lt;p&gt;I also note a commented-out reference to ILLink.Tasks which was a preview feature in Mono's Linker to reduce the final size of apps and tree-trim them. Some of that functionality is built into .NET 6 now so I'll use that during the build and packaging process later. The reference is not needed today.&lt;/p&gt;
  66. &lt;p&gt;I'm gonna blindly upgrade them to .NET 6 and see what happens. I could do this by just changing the numbers and seeing if it restores and builds, but I can also try &lt;a href="https://www.hanselman.com/blog/your-dotnet-outdated-is-outdated-update-and-help-keep-your-net-projects-up-to-date"&gt;dotnet outdated&lt;/a&gt; which remains a lovely tool in the upgrader's toolkit.&lt;/p&gt;&lt;figure&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/16297583fa52_12B8A/image_4a71ee64-6bb1-4730-86f8-689475662465.png" width="999" height="156"&gt;&lt;/figure&gt;
  67. &lt;p&gt;This "outdated" tool is nice as it talks to NuGet and confirms that there are newer versions of certain packages.&lt;/p&gt;
  68. &lt;p&gt;In my tests - which were just batch files at this early time - I was calling my dotnet app like this:&lt;/p&gt;&lt;pre&gt;dotnet netcoreapp2.0/TinyOSCore.dll 512 scott13.txt  &lt;/pre&gt;
  69. &lt;p&gt;This will change to the modern form with just &lt;code&gt;TinyOSCore.exe 512 scott13.txt&lt;/code&gt; with an exe and args and no ceremony.&lt;/p&gt;
  70. &lt;p&gt;Publishing and trimming my TinyOS turns into just a 15 meg EXE. Nice considering that the .NET I need is in there with no separate install. I could turn this little synthetic OS into a microservice if I wanted to be totally extra.&lt;/p&gt;&lt;pre&gt;dotnet publish -r win-x64 --self-contained -p:PublishSingleFile=true -p:SuppressTrimAnalysisWarnings=true&lt;/pre&gt;
  71. &lt;p&gt;If I add &lt;/p&gt;&lt;pre&gt;-p:EnableCompressionInSingleFile=true&lt;/pre&gt;
  72. &lt;p&gt;Then it's even smaller. No code changes. Run all my tests, looks good. My project from university from .NET 1.1 is now .NET 6.0, cross platform, self-contained in 11 megs in a single EXE. Sweet.&lt;/p&gt;
  73. &lt;hr&gt;
  74.  
  75. &lt;p&gt;&lt;strong&gt;Sponsor: &lt;/strong&gt;At Rocket Mortgage® the work you do around here will be 100% impactful but won’t take all your free time, giving you the perfect work-life balance. Or as we call it, tech/life balance! &lt;a href="https://hnsl.mn/3qVUu5O"&gt;Learn more.&lt;/a&gt;&lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/upgrading-a-20-year-old-university-project-to-net-6-with-dotnetupgradeassistant/comments#comments-start</comments><category>DotNetCore</category><category>Open Source</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/d9e0f2ec-d7fd-484e-9b60-35cc70ab1398</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/d9e0f2ec-d7fd-484e-9b60-35cc70ab1398</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/net-6-hot-reload-and-refused-to-connect-to-ws-because-it-violates-the-content-security-policy-directive-because-web-sockets/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/d9e0f2ec-d7fd-484e-9b60-35cc70ab1398</wfw:commentRss><slash:comments>7</slash:comments><title>.NET 6 Hot Reload and "Refused to connect to ws: because it violates the Content Security Policy directive" because Web Sockets</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/d9e0f2ec-d7fd-484e-9b60-35cc70ab1398</guid><link>https://www.hanselman.com/blog/net-6-hot-reload-and-refused-to-connect-to-ws-because-it-violates-the-content-security-policy-directive-because-web-sockets</link><pubDate>Tue, 16 Nov 2021 19:37:00 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;If you're excited about &lt;a href="https://www.youtube.com/watch?v=4S3vPzawnoQ"&gt;Hot Reload&lt;/a&gt; like me AND you also &lt;a href="https://www.hanselman.com/blog/easily-adding-security-headers-to-your-aspnet-core-web-app-and-getting-an-a-grade"&gt;want an "A" grade&lt;/a&gt; from &lt;a href="http://securityheaders.com"&gt;SecurityHeaders.com&lt;/a&gt; (really, go try this now) then you will learn very quickly about &lt;a href="https://content-security-policy.com/"&gt;Content-Security-Policy&lt;/a&gt; headers. You need to spend some time reading and you may end up with a somewhat sophisticated list of allowed things, scripts, stylesheets, etc.&lt;/p&gt; &lt;p&gt;In &lt;a href="https://github.com/poppastring/dasblog-core"&gt;DasBlog Core&lt;/a&gt; (the cross platform blog engine that runs this blog) Mark Downie makes these configurable and uses the NWebSpec ASP.NET Middleware library to add the needed headers.&lt;/p&gt;&lt;pre class="brush: csharp; gutter: false; toolbar: false; auto-links: false; smart-tabs: false;"&gt;if (SecurityStyleSources != null &amp;amp;&amp;amp; SecurityScriptSources != null &amp;amp;&amp;amp; DefaultSources != null)&lt;br&gt;{&lt;br&gt;    app.UseCsp(options =&amp;gt; options&lt;br&gt;        .DefaultSources(s =&amp;gt; s.Self()&lt;br&gt;            .CustomSources(DefaultSources)&lt;br&gt;            )&lt;br&gt;        .StyleSources(s =&amp;gt; s.Self()&lt;br&gt;            .CustomSources(SecurityStyleSources)&lt;br&gt;            .UnsafeInline()&lt;br&gt;        )&lt;br&gt;        .ScriptSources(s =&amp;gt; s.Self()&lt;br&gt;               .CustomSources(SecurityScriptSources)&lt;br&gt;            .UnsafeInline()&lt;br&gt;            .UnsafeEval()&lt;br&gt;        )&lt;br&gt;    );&lt;br&gt;}
  76. &lt;/pre&gt;
  77. &lt;p&gt;Each of those variables comes out of a config file. Yes, it would be more security if they came out of a vault or were even hard coded.&lt;/p&gt;
  78. &lt;p&gt;DasBlog is a pretty large and cool app and we noticed immediately upon Mark upgrading it to .NET 6 that we were unable to use Hot Reload (via dotnet watch or from VS 2022). We can complain about it, or we can learn about how it works and why it's not working for us! &lt;/p&gt;
  79. &lt;blockquote&gt;
  80. &lt;p&gt;Remember: &lt;a href="https://www.hanselman.com/blog/the-internet-is-not-a-black-box-look-inside"&gt;Nothing in your computer is hidden from you&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;
  81. &lt;p&gt;Starting with a simple "View Source" we can see a JavaScript include at the very bottom that is definitely not mine!&lt;/p&gt;&lt;pre class="brush: xml; gutter: false; toolbar: false; auto-links: false; smart-tabs: false;"&gt;&amp;lt;script src="/_framework/aspnetcore-browser-refresh.js"&amp;gt;&amp;lt;/script&amp;gt;
  82. &lt;/pre&gt;
  83. &lt;p&gt;Ok, this makes sense as we know not only does HotReload support C# (code behinds) but also Markup via Razor Pages and changing CSS! It would definitely need to communicate "back home" to the runner which is either "dotnet watch" or VS2022.&lt;/p&gt;
  84. &lt;p&gt;If I change the ASPNETCORE_ENVIRONMENT to "Production" (either via launch.json, launchsettings, or an environment variable like this, I can see that extra HotReload helper script isn't there:&lt;/p&gt;&lt;pre&gt;C:\github\wshotreloadtest&amp;gt;dotnet run --environment="Production"&lt;br&gt;Building...&lt;br&gt;info: Microsoft.Hosting.Lifetime[14]&lt;br&gt;      Now listening on: https://localhost:7216&lt;br&gt;info: Microsoft.Hosting.Lifetime[14]&lt;br&gt;      Now listening on: &lt;a href="http://localhost:5216"&gt;http://localhost:5216&lt;/a&gt;&lt;/pre&gt;
  85. &lt;blockquote&gt;
  86. &lt;p&gt;&lt;strong&gt;Remember: &lt;/strong&gt;You never want to use dotnet run in production! It's an SDK building command! You'll want to use dotnet exec your.dll, dotnet your.dll, or best of all, in .NET 6 just call the EXE directly! .\bin\Debug\net6.0\wshotreloadtest.exe in my example. Why? dotnet run will always assume it's in Development (you literally tell it to restore, build, and exec in one run command) if you run it. You'll note that running the actual EXE is always WAY faster as well! Don't ship your .NET SDK to your webserver and don't recompile the whole thing on startup in production!&lt;/p&gt;&lt;/blockquote&gt;
  87. &lt;p&gt;We can see that that aspnnetcore-browser-refresh.js is the client side of Development-time HotReload. Looking at our browser console we see :&lt;/p&gt;
  88. &lt;p&gt;&lt;img title="Refused to Connect because it violates a CSP Directive" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Refused to Connect because it violates a CSP Directive" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/72550dc07007_14F70/image_1f22b882-9a3f-4fad-b201-fb0f26c86db6.png" width="574" height="159"&gt;&lt;/p&gt;&lt;pre&gt;Refused to connect to 'wss://localhost:62486/' &lt;br&gt;because it violates the following Content Security Policy &lt;br&gt;directive: "default-src 'self'". &lt;br&gt;Note that 'connect-src' was not explicitly set, &lt;br&gt;so 'default-src' is used as a fallback.&lt;/pre&gt;
  89. &lt;p&gt;That's a lot to think about. I started out my ASP.NET Web App's middle ware saying it was OK to talk "back to myself" but nowhere else. &lt;/p&gt;&lt;pre&gt;app.UseCsp(options =&amp;gt; options.DefaultSources(s =&amp;gt; s.Self())); &lt;/pre&gt;
  90. &lt;p&gt;Hm, self seems reasonable, why can't the browser connect BACK to the dotnet run'ed Kestrel Web Server? It's all localhost, right? Well, specifically it's http://localhost not ws://localhost, or even wss://localhost (that extra s is for secure) so I need to explicitly allow ws: or wss: or both, but only in Development.&lt;/p&gt;
  91. &lt;p&gt;Maybe like this (again, I'm using NWebSpec, but these are just HTTP Headers so you can literally just add them if you want, hardcoded.)&lt;/p&gt;&lt;pre class="brush: csharp; gutter: false; toolbar: false; auto-links: false; smart-tabs: false;"&gt;app.UseCsp(options =&amp;gt; options.DefaultSources(s =&amp;gt; s.Self())&lt;br&gt;            .ConnectSources(s =&amp;gt; s.CustomSources("wss://localhost:62895")));
  92. &lt;/pre&gt;
  93. &lt;p&gt;But port numbers change, right? Let's do just wss:, only in Development. Now, if I'm using both CSPs and WebSockets (ws:, wss:) in Production, I'll need to be intentional about this.&lt;/p&gt;
  94. &lt;p&gt;What's the moral?&lt;/p&gt;
  95. &lt;p&gt;&lt;strong&gt;If you start using CSP Headers to tighten things up, be conscious and aware of the headers you need for conveniences like Hot Reload in Development versus whatever things you may need in Production. &lt;/strong&gt;&lt;/p&gt;
  96. &lt;p&gt;Hope this helps save you some time!&lt;/p&gt;
  97. &lt;hr&gt;
  98.  
  99. &lt;p&gt;&lt;strong&gt;Sponsor: &lt;/strong&gt;At Rocket Mortgage® the work you do around here will be 100% impactful but won’t take all your free time, giving you the perfect work-life balance. Or as we call it, tech/life balance! &lt;a href="https://hnsl.mn/3qVUu5O"&gt;Learn more.&lt;/a&gt;&lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/net-6-hot-reload-and-refused-to-connect-to-ws-because-it-violates-the-content-security-policy-directive-because-web-sockets/comments#comments-start</comments><category>DotNetCore</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/a3e8448a-7bc5-4256-b945-ac12db42970d</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/a3e8448a-7bc5-4256-b945-ac12db42970d</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/dotnetconf-2021-net-everywhere-windows-linux-and-beyond/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/a3e8448a-7bc5-4256-b945-ac12db42970d</wfw:commentRss><slash:comments>5</slash:comments><title>DotNetConf 2021 - .NET Everywhere - Windows, Linux, and Beyond</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/a3e8448a-7bc5-4256-b945-ac12db42970d</guid><link>https://www.hanselman.com/blog/dotnetconf-2021-net-everywhere-windows-linux-and-beyond</link><pubDate>Thu, 11 Nov 2021 21:07:00 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;&lt;a href="https://dotnet.microsoft.com/"&gt;.NET 6&lt;/a&gt; is released and it's a LTS release which means it'll be fully and actively supported for the next 3 years. If you've been paused waiting for the right time to upgrade to .NET 6, it's a good time to make the move!&lt;/p&gt; &lt;p&gt;The .NET Upgrade Assistant can take Windows Forms, WPF, ASP.NET MVC, Console Apps, and Libraries and help you - interactively - upgrade them to .NET 6. &lt;/p&gt; &lt;p&gt;Why bother?&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-6/"&gt;Massive and ongoing performance improvements&lt;/a&gt;  &lt;li&gt;No need to count on .NET being on the user's machine. You can ship you own version of .NET and embed it inside your EXE! Check out &lt;a href="https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file"&gt;Single File Deployment&lt;/a&gt;.  &lt;li&gt;Tons of new C# 10 features, but they are optional, so your existing code works great but you can also "refactor via subtraction" and check out things like implicit usings.  &lt;li&gt;Optional Profile-guided optimization (PGO) is where the JIT compiler generates optimized code in terms of the types and code paths that are most frequently used. This can mean even MORE free performance!  &lt;li&gt;&lt;a href="https://devblogs.microsoft.com/dotnet/conversation-about-crossgen2/"&gt;Crossgen2&lt;/a&gt; can dramatically improve your startup time  &lt;li&gt;Support for macOS Arm64 (or "Apple M1 Silicon") and Windows Arm64 operating systems, for both native Arm64 execution and x64 emulation. In addition, the x64 and Arm64 .NET installers now install side by side. For more info, see &lt;a href="https://github.com/dotnet/sdk/issues/22380"&gt;.NET Support for macOS 11 and Windows 11 for Arm64 and x64&lt;/a&gt;.  &lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=4S3vPzawnoQ"&gt;Hot Reload&lt;/a&gt; - just make changes and your app changes...even if you're coding in Notepad!  &lt;li&gt;And &lt;a href="https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-6"&gt;tons more&lt;/a&gt;!&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Check out my .NET Conf 2022 video where I see how many places I can run .NET! Windows, Linux, Docker, Mac, Raspberry Pi, even &lt;a href="https://www.hanselman.com/blog/how-to-install-net-core-on-your-remarkable-2-eink-tablet-with-remarkablenet"&gt;a Remarkable 2 eInk tablet&lt;/a&gt;. Enjoy!&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;center&gt; &lt;div class="embed-container"&gt;&lt;iframe title="YouTube video player" height="315" src="https://www.youtube.com/embed/ZM6OO2lkxA4" frameborder="0" width="560" allowfullscreen allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/center&gt; &lt;p&gt;Be sure to watch and enjoy &lt;a href="https://www.youtube.com/watch?v=HIW86m-kJl0&amp;amp;list=PLdo4fOcmZ0oVFtp9MDEBNbA2sSqYvXSXO"&gt;ALL the great .NET Conf 2022 videos up on YouTube today&lt;/a&gt;.&lt;/p&gt; &lt;hr&gt;  &lt;p&gt;&lt;strong&gt;Sponsor: &lt;/strong&gt;Lob’s developer-friendly APIs make it easy to send a letter, check, or postcard, as easily as email. Design dynamic HTML templates to personalize mail for maximum impact.&lt;a href="http://pubads.g.doubleclick.net/gampad/clk?id=5828753686&amp;amp;iu=/6839/lqm.scotthanselman.site"&gt; Start Exploring with Postman!&lt;/a&gt;&lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/dotnetconf-2021-net-everywhere-windows-linux-and-beyond/comments#comments-start</comments><category>DotNetCore</category><category>Open Source</category></item><item><trackback:ping>https://www.hanselman.com/blog/feed/trackback/5640a57a-b161-4d16-b72c-e8d4d8d9c1e3</trackback:ping><pingback:server>https://www.hanselman.com/blog/feed/pingback</pingback:server><pingback:target>https://www.hanselman.com/blog/post/5640a57a-b161-4d16-b72c-e8d4d8d9c1e3</pingback:target><dc:creator>Scott Hanselman</dc:creator><wfw:comment>https://www.hanselman.com/blog/lets-upgrade-my-main-site-and-podcast-to-net-6-lts/comments#comments-start</wfw:comment><wfw:commentRss>https://www.hanselman.com/blog/feed/rss/comments/5640a57a-b161-4d16-b72c-e8d4d8d9c1e3</wfw:commentRss><slash:comments>4</slash:comments><title>Let's upgrade my main site and podcast to .NET 6 LTS</title><guid isPermaLink="false">https://www.hanselman.com/blog/post/5640a57a-b161-4d16-b72c-e8d4d8d9c1e3</guid><link>https://www.hanselman.com/blog/lets-upgrade-my-main-site-and-podcast-to-net-6-lts</link><pubDate>Tue, 09 Nov 2021 18:43:00 GMT</pubDate><description>&lt;div&gt;&lt;p&gt;&lt;a href="https://dotnet.microsoft.com/?WT.mc_id=-blog-scottha"&gt;.NET 6&lt;/a&gt; is released and it's a LTS release which means it'll be fully and actively supported for the next 3 years. If you've been paused waiting for the right time to upgrade to .NET 6, it's a good time to make the move!&lt;/p&gt; &lt;p&gt;Right now, &lt;a href="https://www.hanselman.com/"&gt;Hanselman.com&lt;/a&gt; and &lt;a href="http://www.Hanselminutes.com"&gt;Hanselminutes.com&lt;/a&gt; (my podcast) are running on some version of .NET 5. You can se by visiting them and scrolling to the very bottom in the footer as I've &lt;a href="https://www.hanselman.com/blog/adding-a-git-commit-hash-and-azure-devops-build-number-and-build-id-to-an-aspnet-website"&gt;added a git commit hash and Azure DevOps Build Number and Build ID to an ASP.NET website&lt;/a&gt; and I'm using &lt;a href="https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.runtimeinformation.frameworkdescription?view=net-5.0"&gt;RuntimeInformation.FrameworkDescription&lt;/a&gt; to output the plain text version of .NET I'm using. This blog is on .NET Core 3.0 which is an LTS release but I'll be working with Mark Downie this week to move it to .NET 6 LTS as he's already got his instance of dasBlog running on 6!&lt;/p&gt;&lt;figure&gt;&lt;img title="&amp;copy; Copyright 2021, Scott Hanselman. Design by @jzy, Powered by .NET 5.0.10 and deployed from commit e5058e via build 20210920.3" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="&amp;copy; Copyright 2021, Scott Hanselman. Design by @jzy, Powered by .NET 5.0.10 and deployed from commit e5058e via build 20210920.3" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/8b9dedfc5c6c_13FA9/image_2dd680f0-71f7-45e1-8101-d1c90157ce50.png" width="999" height="41"&gt;&lt;/figure&gt;  &lt;p&gt;OK, let's see what's involved. Let's start with my podcast site. I've got the code on GitHub and running locally with "dotnet run" on the command line in both Linux and Windows. I can run the "dotnet upgrade assistant" which is great, but I also like to drive stick shift sometimes for smaller projects.&lt;/p&gt; &lt;p&gt;I'll update my TargetFramework in my csproj project file from net5.0 to net6.0 and update the major PackageReferences from 5.0.0 to 6.0.0. It compiles.&lt;/p&gt; &lt;p&gt;Optionally, I'll also run "&lt;a href="https://www.hanselman.com/blog/your-dotnet-outdated-is-outdated-update-and-help-keep-your-net-projects-up-to-date"&gt;dotnet outdated&lt;/a&gt;" which is one of my favorite tools. You'll want to make sure you have a solid test suite and not just do this without testing.&lt;/p&gt;&lt;figure&gt;&lt;a href="https://www.hanselman.com/blog/your-dotnet-outdated-is-outdated-update-and-help-keep-your-net-projects-up-to-date"&gt;&lt;img title="dotnet outdated tells me which packages need updating" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="dotnet outdated tells me which packages need updating" src="https://www.hanselman.com/blog/content/binary/Windows-Live-Writer/8b9dedfc5c6c_13FA9/image_1f913deb-d95e-4797-846f-7339e98be203.png" width="999" height="381"&gt;&lt;/a&gt;&lt;/figure&gt;  &lt;p&gt;I see that some of these are major changes so I can do a diff of these packages with a number of tools, but my favorite is &lt;a href="http://fuget.org"&gt;FuGet.org&lt;/a&gt; (Thanks Frank!) so I can do a &lt;a href="https://www.fuget.org/packages/Selenium.WebDriver/4.0.1/lib/netstandard2.1/diff/4.0.0-alpha07/"&gt;diff between the alpha version of Selenium I'm using&lt;/a&gt; and the released see that the RemoteLogs type is now called Logs.&lt;/p&gt; &lt;p&gt;I will also update my Dockerfile and change versions like this&lt;/p&gt;&lt;pre&gt;FROM mcr.microsoft.com/dotnet/sdk:6.0 as build&lt;/pre&gt;
  100. &lt;p&gt;and&lt;/p&gt;&lt;pre&gt;FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime&lt;/pre&gt;
  101. &lt;p&gt;I'll confirm that these images build and test. I also run my tests optionally inside a container so that's nice.&lt;/p&gt;
  102. &lt;p&gt;Some of my sites use Azure DevOps and others use GitHub Actions. Both use YAML (yay) to manage their config, so I'll update my UseDotNet task in Azure DevOps YAML to version: "6.0.x"&lt;/p&gt;
  103. &lt;p&gt;I'll commit and start building in the cloud!&lt;/p&gt;&lt;pre&gt;Changes to be committed:&lt;br&gt;  (use "git restore --staged &amp;lt;file&amp;gt;..." to unstage)&lt;br&gt;        modified:   Dockerfile&lt;br&gt;        modified:   azure-pipelines.yml&lt;br&gt;        modified:   hanselminutes.core.tests/SeleniumTests.cs&lt;br&gt;        modified:   hanselminutes.core.tests/hanselminutes.core.tests.csproj&lt;br&gt;        modified:   hanselminutes.core/Startup.cs&lt;br&gt;        modified:   hanselminutes.core/hanselminutes-core.csproj&lt;br&gt;&lt;br&gt;$ git commit -m "upgrade to .net 6"&lt;/pre&gt;
  104. &lt;p&gt;I will also confirm that my Azure App Service is set to .NET 6, but this is only needed if I'm NOT running in a Docker Container or if I'm NOT using a self-contained executable.&lt;/p&gt;
  105. &lt;p&gt;Now I repeat this for my podcast and main site and I'm now on .NET 6! The blog (a larger upgrade) is next.&lt;/p&gt;
  106. &lt;hr&gt;
  107.  
  108. &lt;p&gt;&lt;strong&gt;Sponsor: &lt;/strong&gt;Lob’s developer-friendly APIs make it easy to send a letter, check, or postcard, as easily as email. Design dynamic HTML templates to personalize mail for maximum impact.&lt;a href="http://pubads.g.doubleclick.net/gampad/clk?id=5828753686&amp;amp;iu=/6839/lqm.scotthanselman.site"&gt; Start Exploring with Postman!&lt;/a&gt;&lt;/p&gt;&lt;br/&gt;&lt;hr/&gt;© 2021 Scott Hanselman. All rights reserved. &lt;br/&gt;&lt;/div&gt;</description><comments>https://www.hanselman.com/blog/lets-upgrade-my-main-site-and-podcast-to-net-6-lts/comments#comments-start</comments><category>Blogging</category><category>DotNetCore</category></item></channel></rss>

If you would like to create a banner that links to this page (i.e. this validation result), do the following:

  1. Download the "valid RSS" banner.

  2. Upload the image to your own server. (This step is important. Please do not link directly to the image on this server.)

  3. Add this HTML to your page (change the image src attribute if necessary):

If you would like to create a text link instead, here is the URL you can use:

http://www.feedvalidator.org/check.cgi?url=http%3A//www.hanselman.com/blog/SyndicationService.asmx/GetRss

Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda