While working on Blazor Web Assembly 8.0. I was getting this error, while lunching the browser on debug mode.
Failed to launch debug adapter.
If you will go to the LauchSettings.Json file. You will see this “inspectUri”: “{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}”,
The "inspectUri" property in the configuration is used to specify the WebSocket URL for debugging purposes when running a .NET project. This URL is typically used for remote debugging scenarios where you want to connect a debugger, such as Visual Studio Code or Chrome DevTools, to your running .NET application.
In my system, I have not installed chrome browser and i donot want to do remote debugging.
Work Around Approach to fix this issue.
Approach 1: Update to visual latest version. It was bug in Visual Studio 2022 17.8.1
Approach 2: If approach 1 will not work then comment out this line.
For creating CICD pipeline on azure portal for Blazor or Asp.net Core Project is very simple and straight forward. In this short demo post, we will see how do it.
Step 1: Create the App Service like this.
Step 2: Do the required mandatory setting like
Step 3: Do the configuration for GitHub Action setting like given below image. This will help us to create CICD pipeline for us.
Step 4: Now click on create web app.
If you will come to github repo, you will see that azure webapp deployment wizard has already added yaml file for us. which will trigger the deployment process for us.
Step 5: Now change the code on source code and push to GitHub repo. then CICD process will trigger.
Step 7: Now run the created web app. we will see output like this
Summary:
In the above demo, we saw that without writing single line of code azure portal is creating CICD pipeline for us. It will hardly take 5 to 10 min to create CICD pipeline.
But this approach will not work for docker image or deployment on Linux.
Many times, we encounter the need to migrate Silverlight or WPF applications to modern web applications like Blazor WebAssembly. In such scenarios, the typical approach involves re-engineering the Silverlight or WPF application, which can be time-consuming and expensive. However, there is a smarter and easier alternative: we can leverage the ‘Xaml for Blazor‘ NuGet package to reuse our existing XAML code in Blazor WebAssembly. This approach not only saves us significant development time but also reduces costs.
XAML for Blazor is powered by OpenSilver. It is open-source reimplementation of Microsoft Silverlight for the modern Web.
Let’s create one small demo Xaml Timer Control implementation in Blazor WebAssembly application
Step 1: Create the Blazor Web assembly using Visual Studio like this.
Step 2: Give the project Name
Step 3: Go to the visual studio extension and install the XAML for Blazor extension.
Step 4: Right click on Solution explore and install the NuGet package i.e. XamlforBlazor like this
Step 5: Create the Xaml folder, where will keep all xaml related file. For this right click on folder and add new items. You will see the Xaml for Blazor Controls like this
Step 6: Create the Timer Control in Xaml folder and write the code like this
Step 8: Go to Index.razor page and call the Timer xaml control like this
@page "/"
<PageTitle>Index</PageTitle>
<h1>Time Control demo using Xaml for Blazor</h1>
<br />
<XamlForBlazor.XamlElement Type="@typeof(XamlTest.Xaml.Timer.TimerControl)" />
Step 9: Run the application and you will see XAML Timer control is running on browser
Now if you will see on browser console tab, with help of OpenSilver Control dll and wasm, we are able to run xaml code inside the Browser sandbox.
Limitation
Currently this NuGet package is only working with Blazor web assembly. Whenever Blazor Server will come, I will update here in dotnet community.
Summary:
In this step-by-step demo post, we discovered that it is easy to integrate any XAML control into Blazor WebAssembly without the need to write code in Razor pages. This makes the Xaml for Blazor NuGet package extremely valuable when migrating Silverlight or WPF applications to Blazor, as it significantly reduces development time and effort.