.Net程序集覆盖Assembly.GetExecutingAssembly()。CodeBase /外部程序集的位置

编程入门 行业动态 更新时间:2024-10-25 08:21:15
本文介绍了.Net程序集覆盖Assembly.GetExecutingAssembly()。CodeBase /外部程序集的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在项目设置中引用了一个外部程序集DLL(例如,将其复制到c:\project\abc.dll中)。当我从该程序集中调用导出的方法时,出现运行时错误。因为它正在寻找c:\ABC中的文件abc.ini,而.exe错误消息说它在c:\project中找不到abc.ini

I have a reference to an external assembly DLL (say I copy it in c:\project\abc.dll) in the project setting. When I make a call to the exported method from that assembly I get runtime error. Because it is looking for a file abc.ini which is in c:\ABC while the .exe error message saying that it cannot find the abc.ini in c:\project

程序集似乎正在寻找由abc.ini返回的Assembly.GetExecutingAssembly()。CodeBase或Assembly.GetExecutingAssembly()。Location返回的文件夹。

The assembly seems looking for the folder returned by either Assembly.GetExecutingAssembly().CodeBase or Assembly.GetExecutingAssembly().Location for the abc.ini.

如何仅愚弄该装配体,其装配位置位于c:\ABC?

How to 'fool' only that assembly his assembly location is at c:\ABC?

推荐答案

没有合理的方法来更改 GetExecutingAssembly.CodeBase 或 Location 。如果您没有相关程序集的来源,则唯一的解决方案是将程序集复制到c:\ABC

There's no reasonable way to change GetExecutingAssembly.CodeBase or Location. If you don't have source for the assembly in question, your only solution is to copy your assembly to c:\ABC

更多推荐

.Net程序集覆盖Assembly.GetExecutingAssembly()。CodeBase /外部程序集的位置

本文发布于:2023-11-13 10:46:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584163.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程序   位置   Net   Assembly   CodeBase

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!