如何在Visual Studio 2013中创建自己的“resx”文件版本?

时间:2022-10-03 07:01:16

How do you create an xml file that can automatically create a *.designer.cs file similar to how *.resx files do so?

如何创建一个xml文件,可以自动创建类似* .resx文件的* .designer.cs文件?

Basically, I have an xml file (foo.xyz). When it is updated, I want it to automatically create (or update) a *.designer.cs file that is DependantUpon the main foo.xyz file. I have no idea what this process is even called to know how to search for any relevant information about it. Thanks!

基本上,我有一个xml文件(foo.xyz)。当它更新时,我希望它自动创建(或更新)一个* .designer.cs文件,它是DependantUpon主foo.xyz文件。我不知道这个过程甚至被称为知道如何搜索有关它的任何相关信息。谢谢!

1 个解决方案

#1


3  

Resx code behind is generated using PublicResXFileCodeGenerator VS custom tool. Here is a example on how to create new VS Custom tool, its for VS 2008 but I think the same process is in 2013:

Resx代码隐藏是使用PublicResXFileCodeGenerator VS自定义工具生成的。这是一个关于如何为VS 2008创建新VS自定义工具的示例,但我认为2013年的过程相同:

http://www.codeproject.com/Articles/31257/Custom-Tools-Explained

http://www.codeproject.com/Articles/31257/Custom-Tools-Explained

Maybe for your needs it will be easier to go with T4 template code generation.

也许为了您的需求,使用T4模板代码生成会更容易。

#1


3  

Resx code behind is generated using PublicResXFileCodeGenerator VS custom tool. Here is a example on how to create new VS Custom tool, its for VS 2008 but I think the same process is in 2013:

Resx代码隐藏是使用PublicResXFileCodeGenerator VS自定义工具生成的。这是一个关于如何为VS 2008创建新VS自定义工具的示例,但我认为2013年的过程相同:

http://www.codeproject.com/Articles/31257/Custom-Tools-Explained

http://www.codeproject.com/Articles/31257/Custom-Tools-Explained

Maybe for your needs it will be easier to go with T4 template code generation.

也许为了您的需求,使用T4模板代码生成会更容易。