Skip to content

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

Closed

Description

@Illeris

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

Activity

  1. danielhw2 commented on Jan 30, 2022

    @danielhw2

    Same problem here...

  2. MarkNorman commented on Jan 31, 2022

    @MarkNorman

    Also seeing this.

  3. WatchDogsDev commented on Feb 1, 2022

    @WatchDogsDev

    Also here. Any solution for this ?

  4. joseph-passineau commented on Feb 1, 2022

    @joseph-passineau

    Here is the explanation and some possible solutions:
    #361 (comment)

  5. chrpai commented on Mar 12, 2022

    @chrpai

    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.

  6. wensaint commented on Mar 18, 2022

    @wensaint

    roll back to 1.4.1, then the error gone.

  7. akosilataunglahat commented on Jul 21, 2022

    @akosilataunglahat

    roll back to 1.4.1, then the error gone.

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

  8. lvlvlvlvlvlv commented on Aug 25, 2022

    @lvlvlvlvlvlv

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

  9. PeterHric commented on Aug 25, 2022

    @PeterHric

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

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

  10. simonpinn commented on Dec 13, 2022

    @simonpinn

    Same issue #435

  11. ruggedwizard commented on Jan 10, 2023

    @ruggedwizard

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

  12. SeniorKian commented on Mar 23, 2023

    @SeniorKian

    ruggedwizard

    thank you ...

  13. KC7465128305 commented on Jul 23, 2023

    @KC7465128305

    I found the problem.

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

  14. jainam33 commented on Nov 6, 2023

    @jainam33

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

  15. Michael-Bohin commented on Jun 1, 2025

    @Michael-Bohin

    This issue is existing still in 2025. I have managed to fix the issue by setting solution properties - target OS -> Windows. However this fix will only work for me for local development as I will need to deploy on Linux.

    Is there a solution once I will try to build the code for Linux?

    I have read through the mention #512

    @codebude My best understanding at this point, is that if I want to be multiplatform, I should use the BitmapByteQRCode renderer class, correct? (With QRCode being only available if I specifically set target OS to Windows in VS solution properties)

    Also as a unasked-for-feedback, I have run into your library via GPT research recommendation. I think there are likely going to be more users coming from this channel in the future. The information that I cant use the main renderer if I want to compile, but should use the BitmapByteQRCode is quite too deep in the docs. What would help me personally is some specific mention in third pargraph here
    https://github.com/codebude/QRCoder/wiki

    saying something like in bold font:

    If you want to use the QRCode render and are OK being Windows only, set solution - properties - target OS -> Windows

    If you need to be multiplatform, dont use QRCode render, but x, y renderer.

    I bet this docs change will decrease potential lib users bounces in the future.

  16. Shane32 commented on Jun 1, 2025

    @Shane32
    Owner

    The link below shows which renderers are available for various TFMs.

    https://github.com/codebude/QRCoder/wiki/Advanced-usage---QR-Code-renderers

  17. Shane32 commented on Oct 2, 2025

    @Shane32
    Owner
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