Do I need the resx Designer.cs file?

前端 未结 5 2067
礼貌的吻别
礼貌的吻别 2020-11-27 20:52

My company uses a combination of some database tables, a web page front end and an \"export\" application to handle our string resources in our web sites.

The export

5条回答
  •  迷失自我
    2020-11-27 21:38

    If you prefer to automatically generate the *.designer.cs files from *.resx files when building the project, the following approach worked for us and it might work for you as well:

    1. Close your solution
    2. Open as an XML file the project file in which you want to automatically generate the designer files. Note that you need to load it as an XML file. You can't edit these settings through the project property page.
    3. Add a target to the project as follows:
    
       
       
       
       
       
       
       
    
    
    1. Locate the target named "BeforeBuild". This target may be commented out (the default).
    2. Modify the "BeforeBuild" target as follows:
    
       
    
    

    This solution is based on all resource files being listed as "EmbeddedResource" within an ItemGroup of the project file, e.g.

    
      
        PublicResXFileCodeGenerator
        Display_Creditor.Designer.cs
        Acme.Web.Resources.Creditor
      
      
        PublicResXFileCodeGenerator
        Tooltip_InboundEmailDetails.Designer.cs
        Acme.Web.Resources.InboundEmail
      
      
        PublicResXFileCodeGenerator
        Tooltip_CreditorDetails.Designer.cs
        Acme.Web.Resources.Creditor
      
    
    

    Disclaimer: This has been tested with Visual Studio 2013 and C# projects. It may or may not work for other projects and/or other versions of Visual Studio.

提交回复
热议问题