VS2010目标3.5框架上的RESX文件问题 [英] Issues with RESX files on VS2010 targeting 3.5 framework

查看:107
本文介绍了VS2010目标3.5框架上的RESX文件问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我最近遇到的一个故事,还有一个可能的答案(?),我只是想分享此信息,因为在stackoverflow上仍找不到此信息.

Here is a story what I recently ran into and a possible answer(?) I just wanted to share this information because I could not find this yet at stackoverflow.

我将解决方案从VS2008,WinXP,32位升级到VS2010,Win7、64位.

I upgraded my solution from VS2008, WinXP, 32bit TO VS2010, Win7, 64bit.

当我在WinForms上进行修改以生成新的RESX文件或更新RESX文件时,我遇到了问题.

When I make modifications on WinForms that generate new RESX files, or update the RESX files, I'm running into problems.

使用VS2010进行Debug编译没问题.但是对于发布模式,我必须使用延迟签名过程.现在,该过程为VS2010生成的 new RESX文件提供了错误. (再次注意,旧的RESX文件不会显示此行为)

A Debug build with VS2010 was no problem. However for Release mode I have to use a delay-signing process. Now that process gives errors on new RESX files that are generated with VS2010. (Again note that old RESX files do NOT show this behaviour)

(CoreResGen目标) Search.resx(176,5):错误RG0000:无法加载文件或程序集xxx.Controls,版本= 1.5 0,文化=中性,PublicKeyToken = 7acfcc7eabace048'或其依赖项之一.强名验证失败. (从HRESULT开始:0x8013141A)176行,位置5.

(CoreResGen target) Search.resx(176,5): error RG0000: Could not load file or assembly xxx.Controls, Version=1.5 0, Culture=neutral, PublicKeyToken=7acfcc7eabace048' or one of its dependencies. Strong name validation failed. (Exce on from HRESULT: 0x8013141A) Line 176, position 5.

以下是我在网上找到的一些信息

Here is some of the information I found on the web

我想知道其他人是否会遇到这种情况,他们遵循哪种解决方法? 没有变通办法意味着等待VS2010 SP1出来.

I was wondering if other peopele ran into this and which workaround they followed? No workaround would mean, waiting for the VS2010 SP1 to come out.

不幸的是,我正在使用可能已编译为32位的3rd方程序集. (我无法控制他们的构建过程)

Unfortunately I'm using 3rd party assemblies that might have been compiled as 32bit. (I'm not in control of their build process)

-2010年8月11日 一些其他信息.

-- 8/11/2010 Some additional information.

控件本身没有签名或延迟签名.但是控件使用的组件中的组件是带延迟符号的.两种程序集都在同一解决方案中.

The control itself is not signed or delay-signed. But the control is using a component from an assembly that is delay-signed. Both assemblies are in the same solution.

当我将使用程序集更改为针对4.0框架时,此问题已解决. 当我针对3.5框架时,会收到错误消息.

When I change the consuming assembly to target the 4.0 framework the issue is resolved. When I target the 3.5 framework, we get the error.

推荐答案

我们遇到的问题还在于* .resx文件(已在代码中打开,而不是在设计器中打开)中的ImageList:

The issue we experienced was also with the ImageList inside the *.resx file (opened in code, not the designer):

<data name="imageList1.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
    <value>
        [bunch of binary data here]
    </value>
</data>

我们确认这是通过仅删除与ImageList相关的<data />标记(请参见上文),然后在控件的设计器中删除引用:

We confirmed this was by only deleting the <data /> tag related to the ImageList (see above) and then deleting the references in the control's designer:

//initialize
this.imageListSuperHeroes = new System.Windows.Forms.ImageList(this.components);

//control that references the ImageList
this.btnAwesome.ImageKey = "superman.gif";
this.btnAwesome.ImageList = this.imageListSuperHeroes;

从项目资源文件"而不是本地资源"添加控件的图像引用(使用单个图像!),并更新从表单中删除的引用.

Add the image references (use individual images!) of the control from the "Project resource file", rather than the "Local resource" and update the references you removed from your forms.

this.btnAwesome.Image = global::PMPPlus.Properties.Resources.Superman;

为我们修复了该问题,并希望这有助于您朝正确的方向发展.如果不是,请在* .resx周围挖洞,看看是哪个坏的<data />把你搞砸了.

That fixed it for us and hopefully this helps move you in the right direction. If not, dig around the *.resx to see which bad <data /> is screwing you up.

相关链接: http ://connect.microsoft.com/VisualStudio/feedback/details/566131/error-in-resx-file-when-adding-imagelist

他们提出了一些不符合我们需求的解决方法:

They suggested some workarounds that didn't fit our needs:

  • 定位另一个平台和框架
  • 使用标记将C:\ Program Files \ Microsoft SDKs \ Windows \ v7.0A \ Bin目录拧紧!

我们的设置

  • 旧环境:Windows XP 32位
  • 新环境:Windows 7 64位
  • 通用设置:VS2010 +目标框架:3.5 +目标平台:x86

这篇关于VS2010目标3.5框架上的RESX文件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆