简体   繁体   English

从同一解决方案中运行第二个项目

[英]Run a second project from within the same solution

I've been tasked with building a custom updater but are struggling with how to run this.我的任务是构建自定义更新程序,但正在努力解决如何运行它。 I could of course just create a separate app to take care of this but it is preferred that it all stay in the same solution.我当然可以创建一个单独的应用程序来处理这个问题,但最好都保留在同一个解决方案中。 In my solution I have the project "Main" which is a Forms application and the project "AutoUpdater" which is a console application.在我的解决方案中,我有一个表单应用程序项目“Main”和一个控制台应用程序项目“AutoUpdater”。

两个项目的解决方案

My idea was to have "Main" run the "AutoUpdater" console app in a separate process or possibly have the program copy the autoupdater.exe in a temp folder and then run it from there (to prevent file lock)我的想法是让“Main”在单独的进程中运行“AutoUpdater”控制台应用程序,或者可能让程序将 autoupdater.exe 复制到临时文件夹中,然后从那里运行它(以防止文件锁定)

But how to I tell Main to run AutoUpdater?但是如何告诉 Main 运行 AutoUpdater?

您可以使用Process.Start通过提供路径来运行 AutoUpdater exe。

in your main declare a using.在您的主要声明中使用。

using AutoUpdater;

Then you have easy acces to start the Console.然后,您可以轻松访问控制台。

Use the AutoUpdater project's Post build event to copy the output to a location where the Main application can access.使用 AutoUpdater 项目的 Post build 事件将输出复制到主应用程序可以访问的位置。

Read more here : https://docs.microsoft.com/en-us/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2019在此处阅读更多信息: https : //docs.microsoft.com/en-us/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2019

and/or you can add the AutoUpdater's directory to Path Environment variable and use just the executable name in Process.Start method.和/或您可以将 AutoUpdater 的目录添加到 Path Environment 变量,并在 Process.Start 方法中仅使用可执行文件名称。

暂无
暂无

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

相关问题 从同一解决方案MVC中的不同项目访问EF ConnectionString - Accessing EF ConnectionString from different project within same solution MVC 将用户控件从一个项目复制到同一解决方案中的另一个项目 - Copy User Control from one project to another within same solution Xamarin 在同一解决方案中运行其他项目的活动 - Xamarin run activity from other project in same solution c#从同一解决方案中的其他项目运行表格 - c# run form from other project in same solution 如何在同一C#解决方案中以编程方式从“启动”项目中启动第二个项目? - How to programmatically start the second project from the “StartUp” project in the same C# solution? 如何在同一解决方案中执行另一个项目? - How to execute another project within the same solution? 是否可以从同一解决方案中将项目A中的一个页面重定向到项目B中的页面 - Is it possible to redirect from one page in Project A to a page in Project B from within the same solution 是否可以从同一解决方案中将项目A中的一页重定向到项目B中的页面? - Is it possible to redirect from one page in Project A to a page in Project B from within the same solution? 在同一解决方案中的不同测试项目中引用项目中的 C# 命名空间 - Refer a C# namespace in a Project from a different Testing-Project within the same solution 如何运行相同解决方案中的项目? - How can I run a project that is in the same solution?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM