【问题标题】:VS 2019 not building Solution for new projectsVS 2019 没有为新项目构建解决方案
【发布时间】:2020-05-21 09:13:28
【问题描述】:

我昨天更新了 VS 2019,今天我正在尝试为 asp.net 核心 Web 应用程序创建新项目,项目已创建,但是当我构建解决方案或尝试运行解决方案时,我不断收到以下错误。

Error   MSB4018 The "ResolveTargetingPackAssets" task failed unexpectedly.

完整的错误详情

Severity    Code    Description Project File    Line    Suppression State
Error   MSB4018 The "ResolveTargetingPackAssets" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\3.1.2\data\FrameworkList.xml'.
File name: 'C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\3.1.2\data\FrameworkList.xml'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
   at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlTextReaderImpl.FinishInitUriString()
   at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
   at Microsoft.NET.Build.Tasks.ResolveTargetingPackAssets.AddReferencesFromFrameworkList(String frameworkListPath, String targetingPackDllFolder, ITaskItem targetingPack, List`1 referenceItems)
   at Microsoft.NET.Build.Tasks.ResolveTargetingPackAssets.ExecuteCore()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() WebApplicationLoginTest C:\Program Files\dotnet\sdk\3.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets   283 

我能够运行的旧项目,问题似乎只与我创建的新项目有关。

这可能是因为我昨天做了 VS 更新

【问题讨论】:

  • 您是否尝试过此处描述的解决方案?似乎相关github.com/dotnet/sdk/issues/2940
  • 我在网上查看这是否与构建有关,我将查看链接看看这是否可以解决问题
  • 3.1.4是最新版本,是否使用global.json强制SDK版本?

标签: .net visual-studio visual-studio-2019


【解决方案1】:

我在安装新版 Visual Studio 2019 (16.6.0) 后遇到了同样的问题。

就我而言,我通过从 Microsoft 页面重新安装 ASP.net core 3.1 解决了这个问题。

例如,在以下链接中:this

【讨论】:

  • 我尝试修复 VS2019 但我仍然遇到同样的错误。
  • 是的,重新安装 SDK 解决了这个问题。 dotnet.microsoft.com/download/… 不知道为什么会这样,因为它可能会给很多开发人员带来问题
猜你喜欢
  • 1970-01-01
  • 2021-06-16
  • 2011-06-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-13
相关资源
最近更新 更多