【问题标题】:Azure Build agent cant´t find class library referanceAzure Build 代理找不到类库参考
【发布时间】:2019-12-23 10:17:54
【问题描述】:

我创建了一个 C# 类库,我想将它添加到 web 应用程序中。当我在 AzureDevOps 上的构建代理上构建 webapp 时,会发生错误。构建代理找不到类库。我尝试将类库项目添加到解决方案中,但源代码控制选项从未出现。我也试过只添加类库的.dll。但没有运气。

VS 2019 中文件资源管理器的图片:

这是构建代理日志:

    [command]"C:\Program Files\dotnet\dotnet.exe" build d:\a\1\s\OneCalendar\OneCalendar.csproj --configuration release
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Skipping project "d:\a\1\CaseSolutionsTokenValidationParameters\CaseSolutionsTokenValidationParameters\CaseSolutionsTokenValidationParameters.csproj" because it was not found.
  Skipping project "d:\a\1\CaseSolutionsTokenValidationParameters\CaseSolutionsTokenValidationParameters\CaseSolutionsTokenValidationParameters.csproj" because it was not found.
  Restoring packages for d:\a\1\s\OneCalendar\OneCalendar.csproj...
  Restore completed in 872.26 ms for d:\a\1\s\OneCalendar\OneCalendar.csproj.
C:\Program Files\dotnet\sdk\2.2.105\Microsoft.Common.CurrentVersion.targets(1879,5): warning : The referenced project '..\..\CaseSolutionsTokenValidationParameters\CaseSolutionsTokenValidationParameters\CaseSolutionsTokenValidationParameters.csproj' does not exist. [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(11,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(1,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Services\AccountService.cs(1,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Services\JwtService.cs(1,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Startup.cs(3,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Context\UserContext.cs(15,28): warning CS0108: 'UserContext.Users' hides inherited member 'IdentityUserContext<User, string, IdentityUserClaim<string>, IdentityUserLogin<string>, IdentityUserToken<string>>.Users'. Use the new keyword if hiding was intended. [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(372,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(72,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(79,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(86,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(34,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(78,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(122,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(160,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(199,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(271,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(322,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(375,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]

Build FAILED.

C:\Program Files\dotnet\sdk\2.2.105\Microsoft.Common.CurrentVersion.targets(1879,5): warning : The referenced project '..\..\CaseSolutionsTokenValidationParameters\CaseSolutionsTokenValidationParameters\CaseSolutionsTokenValidationParameters.csproj' does not exist. [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Context\UserContext.cs(15,28): warning CS0108: 'UserContext.Users' hides inherited member 'IdentityUserContext<User, string, IdentityUserClaim<string>, IdentityUserLogin<string>, IdentityUserToken<string>>.Users'. Use the new keyword if hiding was intended. [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(11,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(1,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Services\AccountService.cs(1,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Services\JwtService.cs(1,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Startup.cs(3,7): error CS0246: The type or namespace name 'CaseSolutionsTokenValidationParameters' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(372,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(72,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(79,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\AuthController.cs(86,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(34,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(78,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(122,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(160,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(199,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(271,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(322,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
Controllers\CalenderController.cs(375,29): error CS0103: The name 'TokenValidationConstants' does not exist in the current context [d:\a\1\s\OneCalendar\OneCalendar.csproj]
    2 Warning(s)
    17 Error(s)

Time Elapsed 00:00:03.18
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[error]Dotnet command failed with non-zero exit code on the following projects : d:\a\1\s\OneCalendar\OneCalendar.csproj
##[section]Finishing: Build

【问题讨论】:

    标签: c# azure-devops portable-class-library visual-studio-2019


    【解决方案1】:

    我通过在解决方案文件夹中创建一个新的类库并复制并粘贴我已经为第一个类库创建的代码来解决它。

    【讨论】:

    • 没问题。接受了我的回答。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-27
    • 1970-01-01
    • 2019-10-05
    • 1970-01-01
    • 1970-01-01
    • 2019-09-11
    • 1970-01-01
    相关资源
    最近更新 更多