英文:
Multiple projects, building wrong project first and then breaking on deploy - Visual Studio 2022 - Community
问题
我有两个项目。一个是后端(C#),一个是前端(Angular)。
在我的构建属性中,我已经设置了它们构建的顺序。
后端的端口设置为localhost:7049,前端的端口设置为localhost:4200。
然而,当我开始构建时,在输出中我得到了这个:
没有错误消息,服务器似乎也没有启动或部署(根据输出来看)。
然后它启动了Angular项目,它可以正常工作。
然后,如果我关闭命令提示符中的用于发布Angular内容的窗口,我会收到此弹出错误:
如果我点击继续,它会构建和部署后端代码。然后,我可以右键单击前端项目,选择“调试” > “启动新实例”,然后它们都可以正常工作。
显然,这不是理想的工作方式。所以在继续工作之前,我必须解决这个问题。
我已经尝试了一些方法,包括修复Visual Studio,重新安装它,更改构建顺序,在第一个屏幕截图中更改属性页下的依赖关系。我尝试过更改端口等等。
关于下一步应该尝试的建议将非常有帮助。
英文:
I have two projects. One for my backend (C#), one for my front end (Angular)
in my build properties, I have the order with which they need to build set.
the ports are set for localhost:7049 for the backend and localhost:4200 for the front end
However, when I start the build, in the output I get this:
there are no errors and the server never starts or deploys (according to the output)
So then it brings up the Angular project, which works fine.
then if I close the command prompt that has the publishing for the angular stuff, I get this pop up error:
if I click continue, it builds and deploys the backend code. Then I can right click the front end and go to Debug > Start new Instance and then they both work.
Obviously this is not ideal and not how it should work. So before I can continue working on this, I have to figure it out.
I have tried several things, some of which was repairing Visual Studio, reinstalling it, changing build order, changin dependencies under the property page in the first screenshot. I have tried changing ports, a lot of things.
Any suggestions on what to try next would be super helpful
答案1
得分: 0
我找到了答案。问题出在我的 Node 版本。在制作此版本的日期上,18.13 版本是我所使用的版本。
长话短说,我的 Node 版本与多个项目不兼容,所以我卸载了 Node,安装了 16.16.0 版本:
https://nodejs.org/en/blog/release/v16.16.0/
然后问题就解决了。
英文:
I found the answer. It was my node version. as of the date of making this version 18.13 was the version I had.
I found the answer from this:
https://learn.microsoft.com/en-us/answers/questions/1109248/cant-start-frontend-and-backend-projects-at-the-sa
long story short. my node version wasn't playing well with the multiple projects so I uninstalled node and installed version 16.16.0:
https://nodejs.org/en/blog/release/v16.16.0/
and then it was working
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论