怎么让通过ShadowCopyFiles调用起来的Assembly找到或调用应用程序安装路径下的文件?

idiotzeng 2003-07-23 05:27:58
WindowsApplication1调用方式:
AppDomainSetup mainAppDomainSetup = new AppDomainSetup();
mainAppDomainSetup.CachePath = System.IO.Path.GetTempPath();
mainAppDomainSetup.ShadowCopyFiles = "true";
System.AppDomain mainAppDomain = AppDomain.CreateDomain("idiotzeng", null,
mainAppDomainSetup);
mainAppDomain.ExecuteAssembly("WindowsApplication1.exe");

WindowsApplication1.exe安装在某个目录下,需要调用该目录下的某个DLL(C或DELPHI)或是访问某个数据文件

报错:“‘某个DLL’为无效的Windows映像”
...全文
109 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
sjifd 2003-07-25
  • 打赏
  • 举报
回复
刚发现报错的窗口有个标题“xx.exe--损坏的图象”,不会是BadImageFormatException那个BUG吧。。。。
http://support.microsoft.com/default.aspx?scid=kb;en-us;309692
idiotzeng 2003-07-25
  • 打赏
  • 举报
回复
换成下面一句也出问题,UP~~~~~~~~~~~~~~~`
AppDomain.CurrentDomain.ExecuteAssembly("main.exe");
saucer 2003-07-24
  • 打赏
  • 举报
回复
what about WindowsApplication1.exe? is it a .NET assembly? try

System.Diagnostics.Process.Start("WindowsApplication1.exe")
cnhgj 2003-07-24
  • 打赏
  • 举报
回复
是不是DLL的入口点损坏了?还是这个DLL跟你调用的DLL是不同版本的?用Delphi或VC能调用吗?
saucer 2003-07-24
  • 打赏
  • 举报
回复
if you comment out the following line

mainAppDomainSetup.ShadowCopyFiles = "true";

do you see any errors?
idiotzeng 2003-07-24
  • 打赏
  • 举报
回复
WindowsApplication1.exe is a .NET assembly

>>dll load where ?
WindowsApplication1.exe安装目录下的某个文件夹或是安装目录下

用System.Diagnostics.Process.Start("WindowsApplication1.exe")是另外一种方式了,只是看看用ShadowCopyFile这种方式可不可行。
ArLi2003 2003-07-24
  • 打赏
  • 举报
回复
dll load where ?
idiotzeng 2003-07-24
  • 打赏
  • 举报
回复
dll load where ?
好象把这个DLL移到系统目录下去也报错的。。。
idiotzeng 2003-07-24
  • 打赏
  • 举报
回复
还是报错,“应用程序或DLL C:\.....\xx.dll 为无效的Windows映像。请再检测一遍您的安装光盘。

何况我是需要将ShadowCopyFiles设为true的
idiotzeng 2003-07-23
  • 打赏
  • 举报
回复
这个DLL不是.NET Assembly,通过DllImport调用
雪狼1234567 2003-07-23
  • 打赏
  • 举报
回复
具体也说不清,
给你一个例子参考参考:
class Test {
public static void Main() {
AppDomain currentDomain = AppDomain.CurrentDomain;
AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");

currentDomain.ExecuteAssembly("MyExecutable.exe");
// Prints "MyExecutable running on [default]"

otherDomain.ExecuteAssembly("MyExecutable.exe");
// Prints "MyExecutable running on otherDomain"
}
}
还有一篇相关的文章
http://www.csdn.net/Develop/article/19%5C19649.shtm
visualcpu 2003-07-23
  • 打赏
  • 举报
回复
no try

help you up
saucer 2003-07-23
  • 打赏
  • 举报
回复
what is this DLL? is it a .NET assembly?

111,093

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧