.net - Appveyor - .NET MVC 和 NodeJS 构建
问题描述
我有 .NET MVC 应用程序,它托管一个 Angular 应用程序。
我需要使用 Appveyor 配置我的构建 yaml 来构建 .NET 解决方案,还需要 cd 进入 Angular 文件夹并执行 npm install 和 npm build。
我的 Appveyor 文件看起来像
# Project configuration
version: $(versionNumber)-{branch}.{build}
# Location of the cloned repo on the build server
clone_folder: c:\projects\something
# Environment Variables
environment:
nodejs_version: "8"
versionNumber: "1.9.0"
devpackageVersion: "$(versionNumber)-alpha.$(APPVEYOR_BUILD_NUMBER)"
relpackageVersion: "$(versionNumber).$(APPVEYOR_BUILD_NUMBER)"
buildFolder: "$(APPVEYOR_BUILD_FOLDER)"
# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js
- ps: Install-Product node $env:nodejs_version
# branches to build
branches:
only:
- develop
- /releases.*/
- /features.*/
- /bugfixes.*/
- /hotfixes.*/
# Nuget Restore
nuget:
# Retrieve packages from account feed
account_feed: true
# Retrieve packages from project feed
project_feed: true
image: Visual Studio 2017
# Build configuration
platform: Any CPU
configuration: Release
# Step to execute before build
before_build:
# Restore NPM packages
- ps: cd angular
- ps: npm install
- ps: cd ..
# Restore Nuget packages
- cmd: nuget restore something.sln -Verbosity quiet
# Step to build the solution
build:
parallel: true
# Visual Studio solution to build
project: something.sln
verbosity: minimal
# Conditional configuration depending on branch
for:
-
branches:
only:
- develop
- /features.*/
- /bugfixes.*/
# Powershell to pack files for Octopus
after_build:
- ps: octo pack --id=something.something --version="$env:devpackageVersion" --basePath="$env:buildFolder"\something\ --outFolder="$env:buildFolder"\packages\
# Step to create the artifact in AppVeyor
artifacts:
# Path to the packages created above
- path: 'packages\*.nupkg'
# Step to orchestrate Octopus Deploy
deploy:
- provider: Octopus
push_packages: true
create_release: true
project: something
create_release_advanced: --releaseNumber=$(devpackageVersion)
deploy_release: true
environment: QA
server: https://something
api_key: something
deploy_wait: false
push_packages_advanced: --ignoreSslErrors
# Conditional configuration depending on branch
-
branches:
only:
- /releases.*/
- /hotfixes.*/
# Powershell to pack files for Octopus
after_build:
- ps: octo pack --id=something.something --version="$env:relpackageVersion" --basePath="$env:buildFolder"\something\ --outFolder="$env:buildFolder"\packages\
# Step to create the artifact in AppVeyor
artifacts:
# Path to the packages created above
- path: 'packages\*.nupkg'
# Step to orchestrate Octopus Deploy
deploy:
- provider: Octopus
push_packages: true
create_release: true
project: something
create_release_advanced: --releaseNumber=$(relpackageVersion)
deploy_release: true
environment: QA
server: https://something
api_key: something
deploy_wait: false
push_packages_advanced: --ignoreSslErrors
然而,这似乎进入了 npm install 阶段,然后返回 404 或
+ npm install
+ ~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (npm WARN tar EN...2\package.json':String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
我终其一生都无法弄清楚正在发生的事情。
如何执行 npm install 和 npm build,同时构建我的 .NET 解决方案
解决方案
替换- ps: npm install
为- cmd: npm install
或简单- npm install
。npm
写入stdErr
使 AppVeyor 上的自定义 PowerShell 主机不满意的输出。
推荐阅读
- asp.net-mvc - Sitefinity Mvc 小部件在页面上放置时显示为灰色
- javascript - 为什么在 JS 中的函数中函数不返回数字?
- php - CURL 没有收到来自 facebook 的回复
- java - 谷歌广告管理系统设置问题:谷歌在请求广告时返回代码 3 错误
- python - 这个方括号语法和字典是什么,在python中可调用?这些
- amazon-web-services - RDS 跨区域写入延迟
- angular - Angular Elements 使用外部通用 Angular 模块
- javascript - python服务器和javascript websockets之间的通信
- java - Gradle:具有依赖项的自定义 JavaCompile 任务
- c# - ASP.NET Core MVC:为什么可选的列表参数永远不会为空?