I am trying to create an angular 2 application in visual studio 2015 using angular2 cli setup.
I have done the following steps to setup the project
Execute the following command that installs the cli
npm i -g angular-cli
Execute the following command that creates file and folder structure
ng new projectname
Execute the following command that builds the project
ng serve
By default the angular 2 app is served on port 4200. So when I execute the http://localhost:4200 , I can see the index.html page is served on the browser. I understand that it is served via ng server and not IIS. Please correct me if I am wrong. If i copy the folder and file structure and include in my visual studio solution and run it, I see that visual studio uses its own port. Even if I set the port to 4200 in the project properties and try and execute http://localhost:4200 , it doesent work. I believe it is because it is now being hosted by IIS and IIS has no clue of this application. Could somebody tell me how to go about setting it up in real time scenario
I am basically trying to make changes in the html and execute the code using visual studio 2015 editor. I dont any changes reflected
A view of your file structure would be helpful. It sounds like you're simply using Visual Studio as an IDE. If that is correct, I wouldn't worry about using the green play button. You have to run task for it to build, so Task Runner will be your friend. That or just open up console and do you commands from there.
I personally prefer just using an IDE, like visual studio code, but if you must use VS, then I recommend the link below.
Here is a more detailed example of How To Use Angular CLI With Visual Studio 2017 which also works with Visual Studio 2015.
It details on how to set the project's pre-build build event to run ng build. Also, it shows how to copy the CLI output into an ASP.NET web application using the packages.json file.
来源:https://stackoverflow.com/questions/41471862/angular-2-cli-integration-in-visual-studio-2015