Не удалось найти сборку «Microsoft.Owin …» (и многое другое) после обновления Nuget

#.net #visual-studio #nuget #.net-5

#.net #visual-studio #nuget #.net-5

Вопрос:

Сегодня я обновил Nuget для проекта (многие пакеты MS теперь были 5.0)… но теперь я получаю эти ошибки при компиляции:

 1>------ Build started: Project: IcSso.Client.DotNetFramework, Configuration: Debug Any CPU ------
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Owin, Version=4.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Owin.Security, Version=4.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Owin.Security.Cookies, Version=4.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>D:DevelopProjects_IcIcSsoIcSso.Client.DotNetFrameworkAuthHelper.vb(5,9): warning BC40056: Namespace or type specified in the Imports 'System.Web.Mvc' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
1>D:DevelopProjects_IcIcSsoIcSso.Client.DotNetFrameworkAuthHelper.vb(10,44): error BC30002: Type 'Microsoft.Owin.IOwinContext' is not defined.
1>D:DevelopProjects_IcIcSsoIcSso.Client.DotNetFrameworkStartup.vb(5,9): warning BC40056: Namespace or type specified in the Imports 'Microsoft.Owin.Security.Cookies' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
1>D:DevelopProjects_IcIcSsoIcSso.Client.DotNetFrameworkStartup.vb(60,49): error BC30002: Type 'CookieApplyRedirectContext' is not defined.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  

Вот мои пакеты…

 <?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net48" />
  <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net48" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
  <package id="Microsoft.AspNetCore.Cryptography.Internal" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.AspNetCore.DataProtection" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.AspNetCore.DataProtection.Abstractions" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.AspNetCore.DataProtection.Extensions" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.AspNetCore.Hosting.Abstractions" version="2.2.0" targetFramework="net48" />
  <package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="2.2.0" targetFramework="net48" />
  <package id="Microsoft.AspNetCore.Http.Abstractions" version="2.2.0" targetFramework="net48" />
  <package id="Microsoft.AspNetCore.Http.Features" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Extensions.Configuration.Abstractions" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Extensions.DependencyInjection" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Extensions.FileProviders.Abstractions" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Extensions.Hosting.Abstractions" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Extensions.Options" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Extensions.Primitives" version="5.0.0" targetFramework="net48" />
  <package id="Microsoft.Owin" version="4.1.1" targetFramework="net48" />
  <package id="Microsoft.Owin.Security" version="4.1.1" targetFramework="net48" />
  <package id="Microsoft.Owin.Security.Cookies" version="4.1.1" targetFramework="net48" />
  <package id="Microsoft.Owin.Security.Interop" version="2.1.2" targetFramework="net48" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
  <package id="Microsoft.Win32.Registry" version="5.0.0" targetFramework="net48" />
  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
  <package id="Owin" version="1.0" targetFramework="net48" />
  <package id="System.Buffers" version="4.5.1" targetFramework="net48" />
  <package id="System.ComponentModel.Annotations" version="5.0.0" targetFramework="net48" />
  <package id="System.IO.Pipelines" version="5.0.0" targetFramework="net48" />
  <package id="System.Memory" version="4.5.4" targetFramework="net48" />
  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net48" />
  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net48" />
  <package id="System.Security.AccessControl" version="5.0.0" targetFramework="net48" />
  <package id="System.Security.Cryptography.Xml" version="5.0.0" targetFramework="net48" />
  <package id="System.Security.Permissions" version="5.0.0" targetFramework="net48" />
  <package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net48" />
  <package id="System.Text.Encodings.Web" version="5.0.0" targetFramework="net48" />
  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
  <package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
</packages>
  

Есть идеи, почему я получаю все эти ошибки после обновления Nuget? Есть ли у Owin проблемы с другими пакетами .Net 5?

Я попытался очистить папку bin и obj — это не помогло.

Ответ №1:

Попробуйте выполнить следующие действия:

очистите все кэши nuget 1) сначала или удалите все кэши nuget в разделе C:Usersxxx(current user).nugetpackages

2) закройте VS, удалите .vs скрытую папку в папке решения bin и obj папку.

3) перезапустите свой проект, запустите update-package -reinstall в меню Инструменты -> Диспетчер пакетов Nuget -> Консоль диспетчера пакетов

Комментарии:

1. Привет, я использую Visual Studio unlimited 2012. Все работало нормально; но внезапно возникает ошибка «Ошибка 3 Не удалось восстановить пакет NuGet для проекта…: Базовое соединение было закрыто: при отправке произошла непредвиденная ошибка. «. — Я сделал так, как вы предложили; но все равно появляется ошибка Nuget connection closed. пожалуйста, помогите, как это решить.