Skip to content

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

Description

@brentminder

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:
.NET 6 Blazor Server

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions