简体   繁体   English

Process.StartInfo运行资源文件

[英]Process.StartInfo run resource file

I am trying use Process.StartInfo() to launch (with elevated privileges) an exe file I built. 我正在尝试使用Process.StartInfo()启动(以提升的权限)我构建的exe文件。 I tried the following: 我尝试了以下方法:
1. Add the .exe file as embedded resource. 1.添加.exe文件作为嵌入式资源。
2. Use the embedded file as follows: 2.如下使用嵌入式文件:

Assembly _assembly;
Stream _fileStream;
_assembly = Assembly.GetExecutingAssembly();
_fileStream = _assembly.GetManifestResourceStream("projectNamespace.filename.exe")

3.Build a new file from the _filestream, and run it. 3.从_filestream生成一个新文件,然后运行它。

But i'm not allowed to create an instance of the static File type. 但是我不允许创建静态文件类型的实例。

Is there a better way to do this? 有一个更好的方法吗?

Add the file you want to run to the project. 添加要运行该项目的文件。 Right click the file and set "Build Action" to "Content" in the solution explorer. 右键单击该文件,然后在解决方案资源管理器中将“生成操作”设置为“内容”。

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

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