首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Appveyor - .NET MVC和Appveyor构建

Appveyor - .NET MVC和Appveyor构建
EN

Stack Overflow用户
提问于 2018-05-31 00:47:04
回答 1查看 292关注 0票数 1

我有.NET MVC应用程序,托管一个角度应用程序。

我需要使用Appveyor配置我的build yaml来构建.NET解决方案,还需要将cd放入Angular文件夹,然后执行npm install和npm build。

我的Appveyor文件看起来像

代码语言:javascript
复制
# 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安装阶段,然后返回404或

代码语言:javascript
复制
+ npm install
+ ~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (npm WARN tar EN...2\package.json':String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

我无论如何也搞不清楚发生了什么事。

如何执行npm安装和npm构建,同时构建我的.NET解决方案

EN

回答 1

Stack Overflow用户

发布于 2018-05-31 07:45:25

- ps: npm install替换为- cmd: npm install或简单- npm installnpm将输出写入stdErr,这会使AppVeyor上的自定义PowerShell主机不满意。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50609816

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档