Visual_Studio_Package.vsix

时间:2023-01-08 11:06:50
【文件属性】:
文件名称:Visual_Studio_Package.vsix
文件大小:9.91MB
文件格式:VSIX
更新时间:2023-01-08 11:06:50
vs resource https://marketplace.visualstudio.com/items?itemName=DonAirey.ResourceGenerator&ssr=false#qna This package contains a custom tool that can be used to replace the PublicResXFileCodeGenerator that Microsoft uses by default to generate resources. The biggest problem with the Microsoft default code generator is that the generated constructor is protected, which means that it can’t be used to construct strongly-typed resources in Visual Studio in Portable Class Libraries (PCL). Simply replace the PublicResXFileCodeGenerator custom tool on all the resources with ResourceGenerator and a portable version of the resources will be generated. To create portable resources, start with a Portable Class Library project. Create a directory for your resources (e.g. Strings, this step is optional). The right click on the project, select “Add…” and select Resources File from the options. Name the file whatever you want (e.g. Resources, Errors, etc.) and hit Add. Select the .RESX file from the Solution Explorer window and hit F4 to get to the properties. In the Custom Tools property, remove ResXFileCodeGenerator or PublicResXFileCodeGenerator and type in ResourceGenerator. Now your solution can use these strings from code or XAML, in WPF, Windows 8 or UWP projects. To add localization, create a copy of the resource file and add extensions for the cultures you want to support, such as en-GB, fr-FR or any other combination. After adding the resource file, updating the extension, and translating the text (I’m a big fan of Google Translate for this part), you will need to remove the ‘Custom Tool’ property and make sure that each of the culture files has an Embedded Resource as a Build Action. The directory should look like this:

网友评论