错误 RG0000:无法加载文件或程序集“xxx”;或其依赖项之一。访问被拒绝
这是针对 VS2010 下的 Windows 窗体项目。
这是我从 MSBuild 收到的消息:
错误 RG0000:无法加载文件或 集会 '3rdPartyAssembly由项目使用, 版本=1.1.263.0,文化=中立, PublicKeyToken=687bce93d7ce902c' 或 它的依赖项之一。访问权限是 否认。第 174 行,位置 5。 [C:\xxx\src\BackOffice.csproj]
这是用于启动此操作的命令行:
c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/msbuild.exe BackOffice.csproj /p:PlatformTarget=x86
resx 文件的第 174 行,该错误归因于:
<data name="generalImages.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
...
</value>
</data>
generalImages 是一个 ImageList 控件,其中包含用于表单上按钮的图像。
这在我的开发机器上运行良好,但在我的构建服务器上却存在问题。我的工作站是Windows 7 64位,构建服务器是Windows 2008 Server 64位。构建服务器确实安装了 Windows 7.1 sdk。
如果我使用 v3.5 框架中的 msbuild,编译会成功完成。我确实收到了这条警告消息,但目前它并没有给我带来任何问题: 项目文件包含 ToolsVersion="4.0",此版本的 MSBuild 不支持该版本。将项目视为具有 ToolsVersion="3.5"。
这样做的全部原因是实际针对 4.0 框架并使用方法默认值之类的东西,这些在针对 3.5 时不起作用。
我对此进行了搜索和搜索。我遇到过很多与 32 位/64 位问题相关的点击 - 其中图像格式是问题,但这不是我的问题。此错误显示“访问被拒绝”。我确实使用 fuslogvw 尝试找出拒绝访问的来源 - 但我没有看到它,但它实际上没有找到任何程序集。该程序集不在 GAC 中,而是位于项目文件引用所在的项目文件的切线目录中。
这是融合日志:
* 程序集活页夹日志条目(2010 年 8 月 30 日下午 1:44:48)*
操作失败。绑定结果:hr = 0x80070002。系统找不到指定的文件。
程序集管理器加载自: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll 在可执行文件 C:\Program 下运行 文件\微软 SDKs\Windows\v7.1\Bin\ResGen.exe --- 详细的错误日志如下。
===预绑定状态信息===日志:用户=域\用户日志: 显示名称 = 项目使用的 3rdPartyAssembly, 版本=1.1.263.0,文化=中立, 公钥令牌=687bce93d7ce902c (完全指定)日志:Appbase = 文件:///C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin/ LOG:初始 PrivatePath = NULL 日志:动态基础 = 空日志:缓存基础 = 空日志: AppName = NULL 调用程序集: System.Windows.Forms,版本=2.0.0.0, 文化=中立, 公钥令牌=b77a5c561934e089。 === 日志:此绑定在默认加载上下文中启动。日志:使用应用程序 配置文件:C:\Program 文件\微软 SDKs\Windows\v7.1\Bin\ResGen.exe.Config 日志:使用机器配置文件 从 C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config。 日志:政策后参考: 项目使用的 3rdPartyAssembly, 版本=1.1.263.0,文化=中立, PublicKeyToken=687bce93d7ce902c 日志: GAC 查找失败。日志: 尝试下载新 URL 文件:///C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin/3rdPartyAssemblyUsedByProject.DLL。 日志:尝试下载新 URL 文件:///C:/Program Files/Microsoft SDK/Windows/v7.1/Bin/3rdPartyAssemblyUsedByProject/3rdPartyAssemblyUsedByProject.DLL。 日志:尝试下载新 URL 文件:///C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin/3rdPartyAssemblyUsedByProject.EXE。 日志:尝试下载新 URL 文件:///C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin/3rdPartyAssemblyUsedByProject/3rdPartyAssemblyUsedByProject.EXE。 日志:尝试了所有探测 URL,并且 失败。
此刻——我被难住了。不知道下一步该去哪里。任何建议都会受到欢迎。
科尔特
This is for a windows forms project under VS2010.
Here is the message I get from MSBuild:
error RG0000: Could not load file or
assembly
'3rdPartyAssemblyUsedByProject,
Version=1.1.263.0, Culture=neutral,
PublicKeyToken=687bce93d7ce902c' or
one of its dependencies. Access is
denied. Line 174 , position 5.
[C:\xxx\src\BackOffice.csproj]
Here is the command line used to kick this off:
c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/msbuild.exe BackOffice.csproj /p:PlatformTarget=x86
Line 174 of the resx file that was attributed to the error:
<data name="generalImages.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
...
</value>
</data>
generalImages is an ImageList control with images used for buttons on the form.
This works fine on my dev machine, but is a problem on my build server. My workstation is Windows 7 64-bit, the build server is Windows 2008 Server 64-bit. The build server does have the windows 7.1 sdk installed.
If I use msbuild from v3.5 framework, the compile completes successfully. I do get this warning message that is not causing me any problem at this point:
Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5".
The whole reason for this is to actually target the 4.0 framework and use things like method defaults, which do not work when targeting 3.5.
I have searched and searched on this one. I have come across a lot of hits related to 32-bit/64-bit issues -- where the image format is the problem, but this is not my problem. This error says "Access is denied". I did use fuslogvw to try to figure out where the access denied was coming from -- but I am not seeing that it is, but it is not actually finding any assembly. The assembly is not in the GAC, but in a tangential directory to the project file where the project file reference is.
Here is the fusion log:
* Assembly Binder Log Entry (8/30/2010 @ 1:44:48 PM) *
The operation failed. Bind result: hr
= 0x80070002. The system cannot find the file specified.Assembly manager loaded from:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable C:\Program
Files\Microsoft
SDKs\Windows\v7.1\Bin\ResGen.exe
--- A detailed error log follows.=== Pre-bind state information === LOG: User = domain\user LOG:
DisplayName =
3rdPartyAssemblyUsedByProject,
Version=1.1.263.0, Culture=neutral,
PublicKeyToken=687bce93d7ce902c
(Fully-specified) LOG: Appbase =
file:///C:/Program Files/Microsoft
SDKs/Windows/v7.1/Bin/ LOG: Initial
PrivatePath = NULL LOG: Dynamic Base =
NULL LOG: Cache Base = NULL LOG:
AppName = NULL Calling assembly :
System.Windows.Forms, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089.
=== LOG: This bind starts in default load context. LOG: Using application
configuration file: C:\Program
Files\Microsoft
SDKs\Windows\v7.1\Bin\ResGen.exe.Config
LOG: Using machine configuration file
from
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Post-policy reference:
3rdPartyAssemblyUsedByProject,
Version=1.1.263.0, Culture=neutral,
PublicKeyToken=687bce93d7ce902c LOG:
GAC Lookup was unsuccessful. LOG:
Attempting download of new URL
file:///C:/Program Files/Microsoft
SDKs/Windows/v7.1/Bin/3rdPartyAssemblyUsedByProject.DLL.
LOG: Attempting download of new URL
file:///C:/Program Files/Microsoft
SDKs/Windows/v7.1/Bin/3rdPartyAssemblyUsedByProject/3rdPartyAssemblyUsedByProject.DLL.
LOG: Attempting download of new URL
file:///C:/Program Files/Microsoft
SDKs/Windows/v7.1/Bin/3rdPartyAssemblyUsedByProject.EXE.
LOG: Attempting download of new URL
file:///C:/Program Files/Microsoft
SDKs/Windows/v7.1/Bin/3rdPartyAssemblyUsedByProject/3rdPartyAssemblyUsedByProject.EXE.
LOG: All probing URLs attempted and
failed.
At this point -- I am stumped. Not sure where to go next. Any advice would be welcomed.
Cort
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
它看起来很像 位于 blogs.msdn.com。如果是这样,微软似乎决定最早要到 Visual Studio 11 才修复它,并且对于许多人(包括我们 :| )来说,帖子中提到的解决方法都不起作用。祝你好运。
It looks a lot like the known VS 2010 bug described here on blogs.msdn.com. If so, it seems that Microsoft have decided not to fix it until Visual Studio 11 at the earliest, and for many people (including us :| ) none of the workarounds mentioned in the post work. So good luck.
我在 ResGen 上遇到了类似的问题:错误 RG0000:无法加载引用的程序集。就我而言,结果发现解决方案中的项目文件之一尚未正确升级到 vs2010。一旦我将工具引用修复为 4.0,它就可以正常工作了。
I had a similar issue with ResGen : error RG0000: Could not load referenced assembly. In my case it turned out one of the project files in the solution had not been correctly upgraded to vs2010. Once I fixed up the tool references to 4.0 it worked correctly.
团队构建在服务帐户下运行。您是否检查过该帐户是否有权访问第 3 方程序集所在的程序文件位置?
Team build runs under a service account. Did you check whether this account has access to the program files location where the 3rd party assembly is located?
我遇到了MSDN 博客 正如@Joel 的回答中提到的。考虑发布适合我保存的解决方法其他时候,我只是花了半天时间来寻找解决方案。
我使用的解决方法在该博客文章的评论部分中进行了讨论,即在发生错误的 resx 中搜索 j00L 并将其替换为 j0yL。文件。此解决方法的缺点是您需要编辑 resx.txt 文件。每次对图像列表进行更改时都会生成文件。
I faced the exact problem as described in this MSDN blog as mentioned in the answer by @Joel.Thought of posting the workaround that works for me to save others time as I just used up half a day trying for solutions.
The workaround that I used is discussed in the comment sections of that blog post which is to search for j00L and replace it with j0yL in the error occurring resx. files. The bad side of this workaround is you will need to edit the resx. file every time you make changes to the imagelist.