简体   繁体   中英

How to call .exe within WPF application

How to run one WPF exe (which is in 3.5 framework) from another WPF application (4.0 application).

Reason of the above is:
I'm using some third party which only support 3.5 framework and my existing application is on 4.0. I can't change my current application target type b'coz it has around 200 projects that I need to change then.

I'm stuck with this problem, also I need to pass string as an argument in that.

Below was code that I tried, but didn't get any luck with that:

var processInfo = new ProcessStartInfo(path, param);
 Process.Start(processInfo);

EDIT: I changed the path and it works for me. But now the problem is I'm not able to get the Command-line argument in the .exe application. Like Currently I'm passing the "param" (it is a string type of array) as an argument to my .exe. But can anyone please help me that how to get this parameter in the .exe file. Means in the window.Loaded handler I want to get this parameter and based on that I want to perform some action.

如果您提供的路径是相对路径,请检查工作目录(Environment.CurrentDirectory),此API以及许多其他API会在提供相对路径时将其用作创建绝对路径的基本路径。

Starting another process will load the required .NET CLR version for that application. There is no problem starting a .NET application that requires a version different than the current one.

Check if the path has a correct value.

Please post any exceptions you are getting.

You should be able to call a .Net 3.5 application from .Net 4.0 application without using Process.Start() . Just add the 3.5 exe to your references and now you can use types from that assembly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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