无法从解决方案中的包装器项目中运行其他项目 [英] Unable to run other projects from a wrapper project in a solution

查看:44
本文介绍了无法从解决方案中的包装器项目中运行其他项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net核心项目(WebAPI)-项目1".

I have an asp.net core project(WebAPI) - "Project 1".

我有一个控制台应用程序(WebSocket)-"Project 2".

I have a console application(WebSocket) - "Project 2".

我有一个驱动程序项目"Project 3",其中引用了Project 1和Project2.

I have a driver project, "Project 3" which have references to Project 1 and Project 2.

问题:如何从项目3启动项目1和项目2.如果我添加引用后尝试调用main,则项目2/项目1无法找到app.config文件.

Problem: How to start Project 1 and Project 2 from Project 3. If I make i try to call main after adding reference, the project 2/project 1 is unable to find the app.config file.

P.S.:我认为路径正在产生问题,因为我从另一个项目开始,而根路径却不同.

P.S. : I think the path is creating an issue, because I am starting one project from other and root path is different.

尝试使用:

但是,无法找到.exe文件.

but, unable to find .exe file.

推荐答案

按照以下两个步骤解决了问题,

Solved the problem by following these 2 steps,

  1. 将Project 1和Project 2编译为类库而不是控制台应用程序.

  1. compiling Project 1 and Project 2 as a class library rather than console application.

将项目1和项目2的配置设置复制到项目3.

copying configuration settings of Project 1 and Project 2 to Project 3.

代码://从项目3的主体调用项目2和1的启动方法.

CODE: //called startup method of project 2 and 1 from main of project 3.

项目3:

            static void Main(string[] args)
            {
               Project2.Stratup();
               Project1.Stratup();
            }

完成!

这篇关于无法从解决方案中的包装器项目中运行其他项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆