【发布时间】:2022-01-16 12:59:23
【问题描述】:
我正在尝试设置 Azure 管道来构建和发布我的解决方案。解决方案中的所有项目都在 .NET Core 3.1 中。该项目在 Visual Studio 中构建并运行良好,但是当我尝试运行管道时出现以下错误:
##[error]DbConfiguration\DbContexts\Configurations\Write\RequestConfiguration.cs(1,12): Error CS0234: The type or namespace name 'Model' does not exist in the namespace 'CCCC' (are you missing an assembly reference?)
D:\a\1\s\DbConfiguration\DbContexts\Configurations\Write\RequestConfiguration.cs(1,12): error CS0234: The type or namespace name 'Model' does not exist in the namespace 'CCCC' (are you missing an assembly reference?) [D:\a\1\s\DbConfiguration\CCCC.DbConfiguration.csproj]
##[error]DbConfiguration\DbContexts\Configurations\Write\RequestConfiguration.cs(7,66): Error CS0246: The type or namespace name 'Request' could not be found (are you missing a using directive or an assembly reference?)
D:\a\1\s\DbConfiguration\DbContexts\Configurations\Write\RequestConfiguration.cs(7,66): error CS0246: The type or namespace name 'Request' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\DbConfiguration\CCCC.DbConfiguration.csproj]
##[error]DbConfiguration\DbContexts\Configurations\Write\RequestConfiguration.cs(9,49): Error CS0246: The type or namespace name 'Request' could not be found (are you missing a using directive or an assembly reference?)
D:\a\1\s\DbConfiguration\DbContexts\Configurations\Write\RequestConfiguration.cs(9,49): error CS0246: The type or namespace name 'Request' could not be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\DbConfiguration\CCCC.DbConfiguration.csproj]
管道的 YAML 文件:
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
如果解决方案在本地运行良好并且 Visual Studio 没有出现任何错误(或警告),那么此错误的原因可能是什么?
【问题讨论】:
-
能否提供.csproj文件中引用的源代码和包
标签: c# azure asp.net-core azure-devops azure-web-app-service