How to fix the 'Resources' is not a member of 'My'

后端 未结 23 1177
醉话见心
醉话见心 2021-01-17 09:54

I am using VS2010 and in all of my projects \"My.Resources\" is available and shows all the files that are in the \"resources\" section of the project. In this one project I

相关标签:
23条回答
  • 2021-01-17 10:37

    In VS2013, look in the Solution Explorer at [Your Project] -> My Project -> Resources.resx. Click on "Properties" and make sure that "Custom Tool Namespace" says "My.Resources".

    If it does not work just try putting there "My." - Just this "My."

    0 讨论(0)
  • 2021-01-17 10:39

    In VS2010 Look in the Solution Explorer at [Your Project] -> My Project -> Resources.resx. Click on "Properties" and make sure that "Custom Tool Namespace" says "My.Resources". (took me an hour to figure this out)

    0 讨论(0)
  • 2021-01-17 10:39

    The above is a valid solution but I noticed in my case that the error resulted from another issue. Sometimes what we think is the error is actually the result of a preceding error. You can get this error as well if you deleted the resources from the Resource folder in the Solution Explorer. If you intended on removing these resources then you need to actually delete them by clicking the "Remove Resource" button in the Resources section of your project properties. This will then remove traces of the missing item in the underlying auto-generated code. After clearing an icon resource file that was deleted improperly I no longer had an issue with VS losing reference to My.Resources.

    Hope that helps someone.

    Update: I also received this error when I added a resource file to my project when it was open in another program. In my case I added a User Manual word document but it was still open in Word. All I had to do to remedy this issue was delete the word document out of my resources, close it in Word and re-add it again. Once I built the solution the errors went away.

    0 讨论(0)
  • 2021-01-17 10:41

    See the below solution and this what I did.

    PBImage.Image = Global.ProjectName.My.Resources.Resources.PictureName
    
    0 讨论(0)
  • 2021-01-17 10:42

    Had more luck changing "My.Resources" to "MyResources" and changing the Access Modifier of "Resources.resx" to Public (it was previusly Friend Access Modifier)

    Fixed the error for me

    0 讨论(0)
  • 2021-01-17 10:42

    Ran Into the Same Error

    • Using VS Code 2015
    • Loading in .png image files through the Resource Tab in Project > My Project
    • Making a custom button class with reference to the files in Resource

    Solution path

    1. Deleted all the references to the resources in the Resources Tab with [X Remove Resources] and Deleted all the Resources in the file Solution > Project > Resources.
    2. Re-uploaded the .png files through the [add resource] dropdown, loaded files instead of drag and drop.
    3. Renamed file with no underscore (this might be extraneous).
    4. Rebuilt solution
    0 讨论(0)
提交回复
热议问题