none
Missing project reference in release mode RRS feed

  • Question

  • I am using Visual Studio 2019 Community edition (version 16.6.2) and have run into a problem. When I build my project in debug mode everything works fine BUT when I attempt to build the project in release mode I get CS0234 errors for the following three code lines and the build fails:

    using Windows.Devices.Bluetooth;

    using Windows.Devices.Bluetooth.GenericAttributeProfile;

    using Windows.Devices.Bluetooth.Advertisement;

    Further investigation shows that in the debug mode the project has the following project references in debug mode;

    >System.Xml.Xpath.Xdocument

    >Windows

    >WindowBase

    and in release mode

    >System.Xml.Xpath.Xdocument

    >WindowBase

    That is the Windows reference is missing, hence the build fails.

    The reference is missing in the CLASS VIEW
    but is listed in the Solution Explorer.

    Can someone explain how to fix this?


    • Edited by RollinMan Sunday, June 28, 2020 9:33 PM
    Saturday, June 27, 2020 3:29 PM

All replies

  • Did you try to make a new project of similar type, add references and using directives and check if it works?

    Sunday, June 28, 2020 8:07 AM
  • Yes. I tried three times. I may be missing something but I an get the Bluetooth code working in debug mode but it fails in release mode.
    Sunday, June 28, 2020 9:39 PM
  • Hi RollinMan,

    Welcome to MSDN forum.

    I suggest you try to delete or rename the “obj” and “binfolders which are stored in your solution folder, and then rebuild your solution(project) again to see if this fixes your issue.

    Besides, do you add some references or perform some actions which may lead to the related dll files(references) being stored in the “wrong” folder, and make VS can’t find them? Or, maybe some paths of the reference are incorrect? Please kindly check it.

    Feel free to contact me.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 29, 2020 5:49 AM
  • Thanks for the suggestion Tianyu but it didn't work. In fact it made matters worse. Prior to deleting the obj and bin folders I could compile my program in debug mode but after deleting the obj and bin folders even the debug build failed for the same reason as noted above as noted above. That is, the Windows reference is missing in the Class View but is listed in the Solution Explorer.

    Since I am new to Visual Studio I don't know if it is a failure on my part to configure things correctly or if it is a bug in Visual Studio. Fortunately my program is simple and the debug .exe is sufficient to control my Arduino device via Bluetooth but I am loath to build a more complex programs until I can figure this out.

    Monday, June 29, 2020 7:06 PM
  • Hi RollinMan,

    Thanks for your feedback.

    I tried to reproduce your issue but blocked on my side, could you please share me with a simple reproduced sample or some reproduced steps? You can upload it to https://onedrive.live.com/ and share the link here, I will then go to download and check it.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, June 30, 2020 9:48 AM
  • Tianyu:

    A link to a simplified version of my problem can be found at

    https://onedrive.live.com/?id=62B94450C22624D6%2115125&cid=62B94450C22624D6

    FYI: I used the Visual Studio 2019 installer. When given a choice by the installer I installed as much as possible on my internal D drive at D:VisualStudio in order to not stress my SSD drive *(C: drive).  All the normal program files including the winmd file are in their default locations.

    It sure feels like I'm missing something fundamental and I do have a Debug .exe that works so there is no hurry for an immediate solution but until I find a solution I guess I'll use Qt for more elaborate programs.

    RollinMan

    Tuesday, June 30, 2020 4:13 PM
  • Hi RollinMan,

    Thank you for your reply.

    I try to test the sample you shared with me, but I’m afraid when I click this link I get the error message like below. If possible, could you please share the link with me again?

    Looking forward to hearing from you.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 1, 2020 2:14 AM
  • Tianyu

    I have no trouble connecting to
    https://onedrive.live.com/?id=62B94450C22624D6%2115125&cid=62B94450C22624D6
    which contains my project files

    You could you could also try
    https://onedrive.live.com/?id=root&cid=62B94450C22624D6
    where the folder
    ArduinoChromaKeyControl
    contains my project files.

    I also uploaded my D: drive folder VisualStudio which is where the the folders and files for Visual Studio installer place these files.

    Finally, on my machine the file
    C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.18362.0\Windows.winmd
    is what I used for my winmd resource.

    Hope this clarifies things

    RollinMan

    Wednesday, July 1, 2020 4:18 PM
  • Hi RollinMan,

    Please set the "Embed interop types" to True:

    Please refer more here: https://www.hanselman.com/blog/CLRAndDLRAndBCLOhMyWhirlwindTourAroundNET4AndVisualStudio2010Beta1.aspx 

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Thursday, July 2, 2020 7:02 AM
  • Dylan

    Thanks for the suggestion but it didn't work. In fact if I set the "Embed interop types" to True then neither the debug nor the release version will build.
    Thursday, July 2, 2020 5:49 PM