在过去的几周里,我一直在尝试完成一个简单的 CI/CD 管道,至少是第一步。我应该注意,这是我第一次在 CI/CD 中做任何事情。
我的最终目标是自动构建解决方案并将构建的文件发布到我们的暂存环境。
解决方案有 3 层,每层都在一个单独的项目中:数据层、服务、Web。
Nuget正在输出
NuGet Config files used:
C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
C:\Windows\system32\config\systemprofile\.nuget\packages\
https://api.nuget.org/v3/index.json
Installed:
4 package(s) to packages.config projects
我假设这个结果意味着所有项目/packages.config 文件都已被接受,因此所有包都已为解决方案和 3 个 csproj 下载,因此它说明了 4 个包。
但是,对于各种文件,我收到了大约 40 到 50 个与这些类似的错误:
$ & "$env:MSBUILD_PATH" /p:Configuration=Release /clp:ErrorsOnly
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Database\Account.cs(2,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Database\Account.cs(3,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
我目前的yaml代码如下
variables:
NUGET_PATH: 'C:\PATH\TO\nuget.exe'
MSBUILD_PATH: 'C:\PATH\TO\msbuild.exe'
PUBLISH_OUTPUT_DIR: publish
stages:
- build
build_job:
stage: build
only:
- branches
script:
- '& "$env:NUGET_PATH" restore'
- '& "$env:MSBUILD_PATH" /p:Configuration=Release /clp:ErrorsOnly'
artifacts:
paths:
- $PUBLISH_OUTPUT_DIR
任何人都可以看到任何明显的错误吗?