question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type or namespace "QRCode" could not be found in new Blazor Server .Net 6 App

See original GitHub issue

Type 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:open
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
Struduscommented, Apr 18, 2022

I having the same problem in version 1.4.3 and .NET 6. So I downgraded to 1.4.2. Reference: #361

Work for me by downgrading the version to the 1.4.2

0reactions
1973-clintoncommented, Mar 13, 2023

You can try:

PngByteQrCode OR BitmapByteQrCode

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found