Make VS2015 use angular-cli ng at build time in a

2019-07-22 01:47发布

I open a clearer question.

How is it possible on precompile script in a .NET project, to make VS2015 build the Angular2-cli project with angular-cli tools (ng) installed globally via npm.

Steps: - npm install -g angular-cli - In our .NET project under VS2015, on F5 (build) we need ng build to be called.

We tried:

"precompile": [ "npm install -g angular-cli", "npm install", "ng build --prod" ],

But I encounter errors on VS2015 console. Full logs: http://pastebin.com/RMiU6eMe

VS2015 doesn't seem to manage to use globally installed ng command.

I tried in our script to call directly the ng tool installed locally as declared in our package.json via npm install:

"precompile": [ "npm install", "node_modules/angular-cli/bin/ng build --prod" ],

But VS2015 answers as below:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): error : The specified executable is not a valid application for this OS platform.

I don't want to have to run separately from command line ng build (which works by the way...) BEFORE being able to build on VS2015.

1条回答
成全新的幸福
2楼-- · 2019-07-22 02:12

Add a command "build": "ng build", in your package.json, then, instead of trying to run the ng build, just run the npm build.

You can also add this to your package.json to bundling it each time you build your solution.

"-vs-binding": { "BeforeBuild": [ "build" ] }
查看更多
登录 后发表回答