简体   繁体   English

一个Visual Studio解决方案中是否可以有两个不同类型的项目(即,桌面项目和Web项目)?

[英]Can you have two projects of different types (i.e. a desktop project and a web project) in a single visual studio solution?

Let's say I have two C# projects: A and B. 假设我有两个C#项目:A和B。

  • A is a desktop project (Windows Forms Application) A是一个桌面项目(Windows窗体应用程序)
  • B a REST service project (asp.net Web-API). 一个REST服务项目(asp.net Web-API)。

I put them both in a single visual studio professional 2013 solution. 我将它们都放在一个单独的Visual Studio Professional 2013解决方案中。

However, though B smoothly runs on the web server (IIS-express), I cannot run A because visual studio seems to assume it's also a web application and only offers me to run it on IIS-express (though this project has program.cs class which brings in a static void main(...){} method). 但是,尽管B可以在Web服务器(IIS-express)上顺利运行,但是我无法运行A,因为Visual Studio似乎假定它也是一个Web应用程序,并且只为我提供了在IIS-express上运行它的能力(尽管该项目具有program.cs会带来static void main(...){}方法的类。

Two questions: 两个问题:

  1. Can you put two projects of different nature (a desktop project and a web project) in the same solution? 能否将两个不同性质的项目(一个桌面项目和一个Web项目)放在同一解决方案中?

  2. Shouldn't visual studio automatically realize A is a desktop project? Visual Studio不应该自动意识到A是一个桌面项目吗?

For sure you can have 2 projects from different types in one solution ( this is what the solution is made for). 当然,您可以在一个解决方案中拥有2​​个来自不同类型的项目(这正是解决方案的目的)。

And you should be able to run your A project regardless of B .. 而且您应该能够运行A项目,而不管B ..

Right click on the project => Debug => Start New Instance Right click项目=> Debug => Start New Instance

暂无
暂无

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

相关问题 在单个解决方案Visual Studio中使用具有不同配置设置的两个项目 - Using two projects with different configuration settings in a single solution visual studio 我有两个项目的解决方案,如何在Winforms项目中使用库类型项目中的方法? - I have a solution with two projects how can i use methods from the library type project in the winforms project? 在 Visual Studio Online Build Definition 中从具有多个 Web 项目的解决方案构建一个 Web 项目 - Build one web project from a Solution with multiple web projects in Visual Studio Online Build Definition 如何将 Angular 9 SPA 项目和 ASP.NET Core 2.2 MVC 项目组合成一个 Visual Studio 2017 解决方案? - How can I combine an Angular 9 SPA project and an ASP.NET Core 2.2 MVC project into a single Visual Studio 2017 Solution? 了解Visual Studio Web应用程序中的项目类型 - Understanding project types in a Visual Studio web application 将解决方案中的项目合并到一个项目中? - Merge projects in solution into a single project? Visual Studio中是否有命令来使项目依赖于解决方案中的项目? - Is there a command in Visual Studio to get the projects dependent on a project within a solution? Visual Studio 项目类型 - Visual Studio Project Types 您如何从Visual Studio中的其他项目/命名空间/解决方案访问数据/功能? - How do you access data/functions from a different project/namespace/solution in Visual Studio? 将 Web 应用项目添加到我的解决方案中,并且解决方案中的其他项目已经使用 .net 框架,我可以将 .net 核心用于新项目吗? - adding a web app project to my solution, and the other projects in the solution already use .net framework, can I use .net core for the new project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM