为什么我会生成 App_GlobalResources 程序集? (错误 = CS0433)

发布于 2024-09-10 04:11:50 字数 1338 浏览 6 评论 0原文

我正在开发一个 ASP.NET MVC2 项目,我已为其配置了本地化,如下......


I have a separate Resources assembly, containing all my resx files. The settings for each resx file are...

Build Action             = Embedded Resource
Copy to Output Directory = Do not copy
Custom Tool              = PublicResXFileCodeGenerator
Custom Tool Namespace    = Resources

我有一个工具,可以将数据库中的字符串导出到 resx 文件中,并调用 resgen.exe 工具来重新创建 Designer.cs 文件。


即使我更改了浏览器的语言设置并刷新了页面,这一切都非常有效。它会拾取正确的字符串。

那是在一个临时工作文件夹中(我使用 subversion)。我现在已经开始在普通文件夹中工作,但遇到了一个相当奇怪的错误。

编译器错误消息:CS0433: 类型“Resources.XXXX”存在于 两个都 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary 网络平台 文件\根\6c657d01\aaca70ae\程序集\dl3\a36dac65\78c87110_3724cb01\Resources.DLL' 和 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary 网络平台 文件\root\6c657d01\aaca70ae\App_GlobalResources.g6fehiio.dll'

我已删除所有临时 asp.net 文件,重新运行 Web 应用程序,它会重新生成上述两个程序集。真正奇怪的是,在我移动到我常用的工作文件夹之前,这一切都有效。

那么,谁能告诉我是什么生成了这个 App_GlobalResources 程序集,我不需要或不想要它,因为我的所有资源都包含在我创建的资源程序集中。

PS - 我使用 Resources.dll 的原因是为了解决使用数据库提取工具生成资源时遇到的问题。 (请参阅此处< /a>)

PPS - 我正在使用 VS2010

I'm working on a ASP.NET MVC2 project, for which I have configured the localisation as follows ...


I have a separate Resources assembly, containing all my resx files. The settings for each resx file are...

Build Action             = Embedded Resource
Copy to Output Directory = Do not copy
Custom Tool              = PublicResXFileCodeGenerator
Custom Tool Namespace    = Resources

I have a tool which exports the strings from a database into the resx files and calls the resgen.exe tool to recreate the designer.cs file.


This all worked great, even when I changed the language settings of my browser and refreshed the page. It would pick up the correct strings.

That was in a temporary working folder (I use subversion). I've now moved to working in my normal folder and am getting a rather odd error.

Compiler Error Message: CS0433: The
type 'Resources.XXXX' exists in
both
'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary
ASP.NET
Files\root\6c657d01\aaca70ae\assembly\dl3\a36dac65\78c87110_3724cb01\Resources.DLL'
and
'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary
ASP.NET
Files\root\6c657d01\aaca70ae\App_GlobalResources.g6fehiio.dll'

I have deleted all of my temporary asp.net files, re-run the web app and it regenerates both of the above mentioned assemblies. The really odd thing is that this all worked before I moved to my usual working folder.

So, can anyone tell me what is generating this App_GlobalResources assembly, which I don't need or want, because all my resources are contained in the Resources assembly I've created.

PS - The reason I went with Resources.dll was to get around a problem I was having with generating the resources using my database extract tool. (see here)

PPS - I am using VS2010

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

﹂绝世的画 2024-09-17 04:11:50

哦!

我想当我将“常用工作文件夹”切换到所在分支时,“App_GlobalResources”文件夹中有一些文件。

我刚刚尝试在 VS2010 中创建一个新的 App_GlobalResources 文件夹,它告诉我那里已经有一个文件夹,但它不在解决方案资源管理器中。

我在 Windows 资源管理器中查看了很多次,但没有看到该文件夹​​。

不管怎样,问题解决了!

道德:不要信任解决方案资源管理器或 svn 开关来删除不属于工作副本的文件:'(

doh!

I think when I switched my "usual working folder" to the branch this was in, I had some files in a "App_GlobalResources" folder.

I just tried to create a new App_GlobalResources folder in VS2010 and it told me there was already one there, but it wasn't in the solution explorer.

I looked in windows explorer a number of times and just didn't see that folder.

Anyway, problem solved!

moral: don't trust solution explorer or svn switch to delete files that don't belong in the working copy :'(

囍孤女 2024-09-17 04:11:50

虽然我不知道如何停止 App_GlobalResources 在临时 ASP.NET 文件中自动生成程序集。我确实弄清楚了如何摆脱那些烦人的警告。

正如警告所述:

编译器错误消息:CS0433:类型“Resources.XXXX”存在于“c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\6c657d01\”中aaca70ae\程序集\dl3\a36dac65\78c87110_3724cb01\Resources.DLL'和'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\6c657d01\aaca70ae\App_GlobalResources.g6fehiio.dll'< /code>

类型 Resources.XXXX 存在于两个程序集中。将您的自定义工具命名空间更改为“资源”以外的名称,这些警告就会消失。

Although I do not know how to stop App_GlobalResources automatically generationg assemblies in Temporary ASP.NET files. I did figure out how to get rid of those annoying warnings.

As the warning says:

Compiler Error Message: CS0433: The type 'Resources.XXXX' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\6c657d01\aaca70ae\assembly\dl3\a36dac65\78c87110_3724cb01\Resources.DLL' and 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\6c657d01\aaca70ae\App_GlobalResources.g6fehiio.dll'

The type Resources.XXXX exists in both assemblies. Change your Custom Tool Namespace to be something other than "Resources" and these warnings will dissappear.

桃酥萝莉 2024-09-17 04:11:50
  1. 将 .resx 移动到另一个文件夹(不是 App_GlobalResources)
  2. 将自定义工具命名空间设置为“Resources”
  1. Move the .resx to another folder (not App_GlobalResources)
  2. Keep the Custom Tool Namespace set to 'Resources'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文