QRCoder icon indicating copy to clipboard operation
QRCoder copied to clipboard

.NET 6.0 Compilation Error: The type or namespace name 'QRCode' does not exist in the namespace 'QRCoder'

Open Illeris opened this issue 3 years ago • 16 comments

Type of issue

[X] Bug
[ ] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement

Expected Behavior

.NET 5.0 project with QRCoder assembly reference compiles without error. .NET 6.0 project with QRCoder assembly reference does not compile : The type or namespace name 'QRCode' does not exist in the namespace 'QRCoder'

Current Behavior

Possible Solution (optional)

Steps to Reproduce (for bugs)

  • Include library in .NET 5.0 assembly project
  • Include QRCoder (sth like this): QRCoder.QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator(); QRCoder.QRCodeData qrCodeData = qrGenerator.CreateQrCode(payloadMessage, eccLevel); QRCoder.QRCode qrCode = new QRCoder.QRCode(qrCodeData);
  • Compile : will work
  • Switch target of project to .NET 6.0 : error

Compilation: VS2022

Your Environment

Illeris avatar Jan 30 '22 11:01 Illeris

Same problem here...

danielhw2 avatar Jan 30 '22 14:01 danielhw2

Also seeing this.

MarkNorman avatar Jan 31 '22 22:01 MarkNorman

Also here. Any solution for this ?

WatchDogsDev avatar Feb 01 '22 12:02 WatchDogsDev

Here is the explanation and some possible solutions: https://github.com/codebude/QRCoder/issues/361#issuecomment-992152570

joseph-passineau avatar Feb 01 '22 18:02 joseph-passineau

I'm new here but my experience was like this....

I need to create a program to generate some QR codes. Ok new console app and take default of .net 6. Open nuget... this was has 8M downloads lets give it a try. Go to the project and find the 5 line sample and paste it in. Hmmm that's strange this type isn't recognized. Go to issues page and find this issue. Switch to target windows only and not it compiles.

So I'd that a notation be placed in the README.md for newcomers like myself.

chrpai avatar Mar 12 '22 22:03 chrpai

roll back to 1.4.1, then the error gone.

wensaint avatar Mar 18 '22 03:03 wensaint

roll back to 1.4.1, then the error gone.

This works for me. Thank you @wensaint .. :)

akosilataunglahat avatar Jul 21 '22 04:07 akosilataunglahat

QRCode qrcode = new QRCode(codeData); ?????

lvlvlvlvlvlv avatar Aug 25 '22 06:08 lvlvlvlvlvlv

QRCode qrcode = new QRCode(codeData); ?????

Actually no - I had to take it back.. Apparently I solved it other way.. Dunno how :)

PeterHric avatar Aug 25 '22 12:08 PeterHric

Same issue #435

simonpinn avatar Dec 13 '22 01:12 simonpinn

rollback to version 1.4.1, this fixes the QRCode issues on Dotnet 6.0 and also 7.0

ruggedwizard avatar Jan 10 '23 08:01 ruggedwizard

ruggedwizard

thank you ...

SeniorKian avatar Mar 23 '23 10:03 SeniorKian

I found the problem.

Go to the project properties, in the Target OS, specify it to Windows. Rebuild the solution. Problem solved.

KC7465128305 avatar Jul 23 '23 07:07 KC7465128305

Just switch to Nuget package manager version 1.4.1 first uninstall latest version of QRCoder then install 1.4.1

jainam33 avatar Nov 06 '23 10:11 jainam33