问题
I am trying to figure out how do you run all the fancy command line commands when working with Cordova / Ionic in Visual Studio and I cannot really figure it out. I have created Ionic project and it works just fine with what is possible in Visual Studio, but there are things that are not supported (various commands that Ionic or Cordova provide). E.g. I want to run this:
ionic serve --lab
or this:
cordova serve
I cannot really figure out where to run this? I tried ordinary command line, but it does not work. What should I do to make this run?
回答1:
Visual studio doesn't have a command line integration built into it. So you would have to use your normal command prompt to use your CLI commands. How did you install ionic/cordova? If you installed in from NPM, using "npm -g install ionic", then it should already be in your path to run it from anywhere. Else you might have to add it into your path. Typically you would find your Cordova/Ionic under %appdata%/roaming/npm/npm_modules.
Typically here is the guidance for using Ionic/Cordova projects in VS
- Install ionic "npm install -g ionic"
- Create a project "ionic start myApp"
- cd to the project "cd [path]\myApp"
- ionic serve
For VS -
- Open VS and Choose File --> New --> Create from Existing project
- Point the path to [path]\myApp : This will create a VS Cordova project
- Run/Build/Debug your project in VS.
Use you command prompt for any Ionic commands.
来源:https://stackoverflow.com/questions/34178951/how-to-run-commands-for-cordova-ionic-in-visual-studio