English 中文(简体)
MVC2项目(外部应用/描述)中转x文档的“ Custom工具”
原标题:"Run Custom Tool" for resx files in MVC2 project (from an external application/script)

我正试图为我的MVC项目提供地方化,该项目与我们现有的编辑资源基础设施合作。 我们把我们的所有资源储存在数据库表格中,并有一个头端的网络名称,以便与这些表格连接起来,并有一个产生微量文档的出口应用程序。 所有这一切都发挥了巨大作用,但我对使用MVC2和VS2010的新项目几乎没有困难。

我已经问到

现在,我已经根据一些人的建议,改变了资源组合(而不是应用全球资源)。 并且针对我的档案有以下背景......

Build Action             = Embedded Resource
Copy to Output Directory = Do not copy
Custom Tool              = PublicResXFileCodeGenerator
Custom Tool Namespace    = Resources
File Name                = MyApp.resx

我改变了出口申请,以管理resgen.exe 具有以下参数的工具......

string args = string.Format("/publicClass "{0}" /str:cs,Resources,{1},"{2}"", resourceFile, Path.GetFileNameWithoutExtension(resourceFile), csFilename);

......这产生了几乎完全相同的设计者.cs档案,因为我先在我的项目中加上“resx”档案。 唯一的区别是:

编造者.cs文档与我管理转基因时的档案略有不同。 在我的出口申请中采用外部工具。

这是VS2010年制定的法典,当时我首先在我的资源夹中添加了resx文档......。

public static global::System.Resources.ResourceManager ResourceManager {
    get {
        if (object.ReferenceEquals(resourceMan, null)) {
            global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Resources.MyApp", typeof(MyApp).Assembly);
            resourceMan = temp;
        }
        return resourceMan;
    }
}

......当我管理转基因时的区别。 具体工具是:MyCompany。 MyApp至资源管理者名称空间

new global::System.Resources.ResourceManager("MyCompany.MyApp.Resources.MyApp", typeof(MyApp).Assembly);

现在,对我来说,这似乎是一个好兆头。 外部工具,因为我已告诉它,我的资源名称空间是Resources,而不是MyCompany.MyApp.Resources

因此,这一问题是否有固定/工作办法?

我目前能够想做的唯一事情是,在后处理所生成的设计者。

最佳回答

最后,我已经解决这个问题。

我决定简化事情,把我的资源用于新的大会,称为<>Resources。 然后,我增加了我的参考文件,并将这些档案的财产确定如下......

Build Action             = Embedded Resource
Copy to Output Directory = Do not copy
Custom Tool              = PublicResXFileCodeGenerator
Custom Tool Namespace    = Resources
File Name                = MyApp.resx

我随后将出口申请改为......。

resgen MyApp.resx /str:c#,Resources,MyApp,MyApp.designer.cs /publicClass

......并删除* 倍数中的资源(由树脂产生的,但不需要)

这把建筑商的序号rid到ResourceManager,然后在我的网络应用中添加提及我的新的Resources

我进行了几次测试,以确保所有物品都很好,包括进入设计师的档案,并删除其中一项财产,造成汇编错误。 接着,我的出口回头,一切都再次奏效。

因此,我很高兴!

问题回答

暂无回答




相关问题
Sharing asp.net resource files between web applications

I have multiple projects that need to share resource files (.resx) Suggestions have been made to move resource files to a separate assembly and have web projects reference it. Is there an example of ...

images added into resx file

This has been a interesting file for me. I found that ,whenever a image is added to this ,the image is actually converted into bytes and stored as data rather than a file. I just want to know the ...

adding different language strings to a single resource file

I have a small application, which includes a resource (.resx) file. This file contains an icon, and a string, which is used by another application. The icon will be displayed on a button, and the ...

ASP.NET MVC - Local Resource Issue

I am having an issue when attempting to override the DisplayNameAttribute in ASP.NET MVC to provide a localized string. The code itself is straightforward and similar to that in another Stackoverflow ...

Editing .resx files on a Mac [closed]

Is there any app that I can use to edit .resx files on a Mac running OSX? I just need to be able to edit string resources. Edit. I know .resx files are XML files. However, I am looking for an app ...

Free/Open Source resx files with Standard Phrases

I was wondering if there are any free/OS resx files for phrases commonly used among websites. For instance, we all use save/submit/retry/cancel/etc. and I d be surprised if there wasn t a library out ...

ASP.NET component to edit .resx files

I m developing a multilingual web site and the localization is done mostly by using .resx files. But now I need to enable users with some permissions to edit resource files online from the web site. ...

热门标签