Type or namespace "QRCode" could not be found in new Blazor Server .Net 6 App
See original GitHub issueType of issue
[X] Bug
Expected Behavior
I’m trying your sample code for QRCoder, and the “QRCode” reference in the code should be found from the using statement: @using QRCoder … QRCode qrCode = new QRCode(qrCodeData);
Current Behavior
I’m getting type or namespace" QRCode "could not be found in a brand new Blazor Server .Net 6 app using your sample code: @using QRCoder … QRCode qrCode = new QRCode(qrCodeData);
Steps to Reproduce (for bugs)
Create a blazor server app and paste this code into the index.razor page:
@page "/"
@using QRCoder
@using System.Drawing
<h1>Hello, world!</h1>
@code {
protected async override Task OnInitializedAsync()
{
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(20);
await base.OnInitializedAsync();
}
}
Your Environment
VS 2022 latest Nuget QRCoder latest: <PackageReference Include="QRCoder" Version="1.4.3" /> .NET 6 Blazor Server
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
c# - Blazor the type or namespace name 'App' could not be ...
The error I got (using Visual Studio 2019 v16.8.2 & .NET 5 in a Blazor Server App) was pointing to the "App" part...
Read more >C# the type or namespace name could not be found (are ...
Solution 1 The problem is that it can't find the class - it's not in the same namespace as your current code. That...
Read more >System.Drawing.Common only supported on Windows - .NET
Learn about the .NET 6 breaking change where the System.Drawing.Common package is no longer supported on non-Windows operating systems.
Read more >Create QR Code In Blazor Using ASP .Net Core
This article demonstrates how to generate QR Codes in a Blazor application. Microsoft created the Blazor framework to let developers create ...
Read more >QRCoder 1.4.3
QRCoder is a simple library, written in C#.NET, which enables you to create QR codes. It hasn't any dependencies to other libraries and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Work for me by downgrading the version to the 1.4.2
You can try:
PngByteQrCode OR BitmapByteQrCode