0

I have a runtime System.Resources.MissingManifestResourceException on my VB.Net VSTO. I read this was likely due to wrong settings in my resources file. So I went into the properties and made sure Build Action was set to Embedded Resource(and it was).

Just below, I saw Copy to Output Directorywas set to Do not copy. I thought it would not hurt if I just changed it to Copy always and gave it a try to compile.

It did not fix anything, but now Build Action has changed to Content, and I have dozens of BC30456 errors:

'Resource' is not a member of 'WordAddIn.My'

When I go to the error, I end up in a UserControl designer, and the line with an error shows: Me.Button_Foo.Image = Global.WordAddIn.My.Resources.Resources.Resource_Bar

I did set my resources file settings back to what they were (Embedded Resource, and Do not copy), but the errors remain..

Note: the namespace of Resources.Designer is My.Resources, and the Resources class and its members are Friend. However intellisense does not let me access the namespace from any of the objects where I have the build errors. I have tried changing the "Custom Tool Namespace" for other names but It does not appear from anywhere in the project. (the custom tool does update the Resources.Designer.vb file, and I would say it does it properly)


UPDATE

Resources.Designer.vb is not included in the project, but shows in the "Miscellanous Files". Same symptom as this post: Visual Studio - project shows up as "Miscellaneous Files"

I did (1) exclude the Resources.resx (cannot work on Resources.Designer.vb alone) from the project, (2) clean the solution, (3) restart Visual Studio, (4) clean the solution (zust'in'kase), (5) an then re-included it, the problem now is that Resources.Designer.vbis included in the project, but does not sit as "embeded" within the Resources.resx, so I am afraid I might have broken it?

Ama
  • 1,373
  • 10
  • 24

1 Answers1

0

The fix with Visual Studio 2017 was the following:

  1. Note the Custom Tool namespace: in solution explorer, right click the Resources.resx file -> 'Properties' and memorize the value for the 'Custom Tool Namespace' field. (needed for step 6)
  2. Remove the Resources.resx and the Resources.Designer.vb files from project: in solution explorer, for each file, right click -> "Exclude from project"
  3. Clean / Rebuild solution
  4. Restart Visual Studio
  5. Re-include the Resources.resx file , but not the Resources.Designer.vb: in solution explorer, make sure you have the [Show All Files] button enabled (near [Refresh]); the resources file should appear with a greyed folder/file symbol next to it; right click -> "Include in project" (or alternatively, right click on the 'My Project' node and choose 'Add' / 'Existing item..'
  6. In solution explorer, right click on Resources.resx -> 'Properties': make sure 'Custom Tool' value is "PublicVbMyResourcesResXFileCodeGenerator"; and that 'Custom Tool Namespace' corresponds to the value it had before you removed the file from project (see step 1.).
  7. In solution explorer, right click on Resources.resx -> 'Run Custom Tool'
  8. A new designer file should be generated automatically.
Ama
  • 1,373
  • 10
  • 24