简体   繁体   English

从2.0应用程序启动外部4.0进程

[英]Starting an external 4.0 process from a 2.0 application

There has been some mention of using 4.0 libraries from a 2.0 app, using COM interop. 有人提到使用COM互操作从2.0应用程序使用4.0库。 My requirement is slightly different in that I do not want to expose types to my 2.0 app, but I have a Diagnostics.Process.Start(....) command in the 2.0 application which until now, started an external EXE elsewhere on the local drive that had also been compiled under 2.0 framework. 我的要求略有不同,因为我不想将类型公开给我的2.0应用程序,但是我在2.0应用程序中有Diagnostics.Process.Start(....)命令,直到现在,该命令在Windows 2000的其他位置启动了外部EXE。本地驱动器也已在2.0框架下进行了编译。

The external EXE has since been upgraded to using framework 4.0 and the Diagnostics.Process.Start no longer works, it seems for this reason. 此后,外部EXE已升级为使用框架4.0,并且Diagnostics.Process.Start不再起作用,似乎是出于这个原因。

I have tried to change the framework type under the .csproj files for the called EXE, recompiled and tried that but still no joy, not sure if now that it is under VS2010 it is irreversibly changed to no longer be compatible with 2.0. 我已经尝试为调用的EXE更改.csproj文件下的框架类型,重新编译并尝试了该操作,但仍然不满意,不确定现在是否在VS2010下是否不可逆地更改为不再与2.0兼容。 I wouldn't have thought this would be an issue as like I said I am not calling types in a library, I am just using Diagnostics.Process.Start to start an external EXE, which surely it shouldn't matter what version of framework it is compiled under? 我不会以为这会是一个问题,就像我说过的那样,我没有在库中调用类型,我只是在使用Diagnostics.Process.Start来启动外部EXE,所以肯定与框架的哪个版本无关它被编译下吗?

Has anyone experienced anything like this? 有没有人经历过这样的事情?

If you're launching a brand new process for your 4.0 executable, the framework version should be irrelevant. 如果要为4.0可执行文件启动全新的过程,则框架版本应该无关紧要。 The two processes are separate with different environments. 这两个过程在不同的环境中是分开的。 Can you specify the errors you're getting when trying to launch the new 4.0 EXE? 您可以指定尝试启动新的4.0 EXE时遇到的错误吗?

If changing the target framework to 2.0 in the new projects fails as well, I'm guessing it's something else. 如果在新项目中将目标框架更改为2.0也失败,我想那是另一回事了。 Maybe code access security, or general permissions? 也许是代码访问安全性,还是一般权限?

Edit: If you're not getting explicit error messages but just seeing your 4.0 EXE start and close without warning, try using tools like ProcMon or DbgView to catch unexpected messages, or add a call to System.Diagnostics.Debugger.Attach() in your 4.0 process's main entrypoint, to enter debugging and see what's going on. 编辑:如果您没有收到明确的错误消息,而只是看到4.0 EXE的启动和关闭而没有警告,请尝试使用ProcMonDbgView之类的工具来捕获意外消息,或者在其中添加对System.Diagnostics.Debugger.Attach()的调用您4.0进程的主要入口点,以进入调试并查看发生了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM