Visual Studio Plug-in (vsix) Menu Commands Localization

60 views Asked by At

I encountered a problem. I created a plug-in project in VS2022 (17.6), and then tried to localize the menu of the plug-in. I modified it many times with reference to the official documentation, but it kept failing. I didn't find any problems.

The following is a screenshot of the test case:

(1) Project directory

(2) Project configuration file

(3) AssemblyInfo.cs

I read the documentation carefully and spent a long time without finding any problems. I hope everyone can help me.

This is the wrong demo path: Vsix Demo

1

There are 1 answers

0
hello On

By re-creating a new plug-in project, I found that after VS compilation is completed, an empty resource file (EmptyResource.resx) will be generated by default in the "obj" directory, but the console prompts that the resource file does not exist (actually exists) and a warning message : "VSSDK1009: Could not find any matching cto files to merge for resource 'obj\Debug\EmptyResource.resources". I think this is the reason why the plug-in disappears in VS (that is, the menu resources cannot be merged into the .cto file), and I also found that the decompiled resource DLL file does not output menu resources.

So my solution: Create two resource files (zh-hans, en-US) without content and configure them as MergeWithCTO in the project file。 eg:

   <EmbeddedResource Include="VSpackage.zh-Hans.resx">
     ....
     <MergeWithCTO>true</MergeWithCTO>
   </EmbeddedResource>