简体   繁体   English

Azure 内部版本 - 名称空间“Microsoft”中不存在类型或名称空间名称“OpenApi”

[英]Azure Builds - The type or namespace name 'OpenApi' does not exist in the namespace 'Microsoft'

Given:鉴于:
New to Azure Builds Azure 新版本

I have a simple WebApi project that uses Swashbuckle.AspNetCore.我有一个使用 Swashbuckle.AspNetCore 的简单 WebApi 项目。 Everything works fine locally (of course) but when I try to build in Azure builds I get the following error:在本地一切正常(当然),但是当我尝试构建 Azure 构建时,我收到以下错误:

The type or namespace name 'OpenApi' does not exist in the namespace 'Microsoft'命名空间“Microsoft”中不存在类型或命名空间名称“OpenApi”

I added the SwashBuckle and OpenApi NuGet packages to Azure Artifacts and referenced that in my build script.我将 SwashBuckle 和 OpenApi NuGet 包添加到Azure Artifacts并在我的构建脚本中引用了它。

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    vstsFeed: '/12b2f6b8-fb61-4aac-a526-27a85a46a5b4'

/reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\System.Xml.XPath.XDocument.dll" /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\WindowsBase.dll" /debug+ /debug:portable /filealign:512 /optimize+ /out:obj\Release\netcoreapp3.1\ApiApplication1.dll /target:exe /warnaserror- /utf8output /deterministic+ /analyzer:"C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Analyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll" Controllers\WeatherForecastController.cs Pro /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\System.Xml.XPath.XDocument.dll" /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\WindowsBase.dll" /debug+ /debug:portable /filealign:512 /optimize+ /out:obj\Release\netcoreapp3.1 \ApiApplication1.dll /target:exe /warnaserror- /utf8output /deterministic+ /analyzer:"C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.SdkAsp.Web\Microsoftanaly .Analyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll" /analyzer: “C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll”控制器\WeatherForecastController.cs Pro gram.cs Startup.cs WeatherForecast.cs "C:\Users\rodneysantiago\AppData\Local\Temp.NETCoreApp,Version=v3.1.AssemblyAttributes.cs" obj\Release\netcoreapp3.1\ApiApplication1.AssemblyInfo.cs /warnaserror+:NU1605 Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn gram.cs Startup.cs WeatherForecast.cs "C:\Users\rodneysantiago\AppData\Local\Temp.NETCoreApp,Version=v3.1.AssemblyAttributes.cs" obj\Release\netcoreapp3.1\ApiApplication1.AssemblyInfo.cs /warnaserror+ :NU1605 使用与目录中的编译器共享编译:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn

[error]RsWpfAndApiSolution\ApiApplication1\Startup.cs(12,17): Error CS0234: The type or namespace name 'OpenApi' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [错误]RsWpfAndApiSolution\ApiApplication1\Startup.cs(12,17):错误 CS0234:命名空间“Microsoft”中不存在类型或命名空间名称“OpenApi”(您是否缺少程序集引用?)

Startup.cs(12,17): error CS0234: The type or namespace name 'OpenApi' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\agent2_work\2\s\RsWpfAndApiSolution\ApiApplication1\ApiApplication1.csproj] Done Building Project "C:\agent2_work\2\s\RsWpfAndApiSolution\ApiApplication1\ApiApplication1.csproj" (default targets) -- FAILED. Startup.cs(12,17):错误 CS0234:命名空间“Microsoft”中不存在类型或命名空间名称“OpenApi”(您是否缺少程序集引用?) [C:\agent2_work\2\s\RsWpfAndApiSolution\ ApiApplication1\ApiApplication1.csproj] 完成构建项目“C:\agent2_work\2\s\RsWpfAndApiSolution\ApiApplication1\ApiApplication1.csproj”(默认目标)- 失败。 Done Building Project "C:\agent2_work\2\s\RsWpfAndApiSolution\RsWpfAndApiSolution.sln" (default targets) -- FAILED.完成构建项目“C:\agent2_work\2\s\RsWpfAndApiSolution\RsWpfAndApiSolution.sln”(默认目标)——失败。

Build FAILED.构建失败。

在此处输入图像描述

Uninstall Swashbuckle.AspNetCore and reinstall with the latest version of the same package to resolve this error.卸载 Swashbuckle.AspNetCore 并使用相同的 package 的最新版本重新安装以解决此错误。 Unfortunately VS doesn't show this error but its caught in CI/CD or when you run in Command Line.不幸的是,VS 没有显示此错误,但它在 CI/CD 中或在命令行中运行时被捕获。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 命名空间“Microsoft”中不存在类型或命名空间名称“Azure” - The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' 命名空间“Microsoft.SqlServer”中不存在类型或命名空间名称“Management” - SqlParser和VSTS自动构建 - The type or namespace name 'Management' does not exist in the namespace 'Microsoft.SqlServer' - SqlParser and VSTS automated builds 错误 CS0234:命名空间“Microsoft”中不存在类型或命名空间名称“Azure”(您是否缺少程序集引用?) - error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) 命名空间“Microsoft.VisualBasic”中不存在类型或命名空间名称“FileIO” - The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic' 类型或名称空间名称“ DirectX”在名称空间“ Microsoft” Windows 8.1中不存在 - The type or namespace name 'DirectX' does not exist in the namespace 'Microsoft' Windows 8.1 命名空间“Microsoft”中不存在类型或命名空间名称“设备” - The type or namespace name 'Devices' does not exist in the namespace 'Microsoft' 命名空间“Microsoft”中不存在类型或命名空间名称“Bot”? - The type or namespace name 'Bot' does not exist in the namespace 'Microsoft'? 类型或名称空间名称“ FriendlyUrls”在名称空间“ Microsoft.AspNet”中不存在 - The type or namespace name 'FriendlyUrls' does not exist in the namespace 'Microsoft.AspNet' 命名空间“Microsoft”中不存在类型或命名空间名称“Reporting” - The type or namespace name 'Reporting' does not exist in the namespace 'Microsoft' 命名空间“Microsoft”中不存在类型或命名空间名称“TeamFoundation” - The type or namespace name 'TeamFoundation' does not exist in the namespace 'Microsoft'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM