VS 2019不为新项目建设解决方案

问题描述 投票:0回答:1

我昨天更新了VS 2019,今天我试图为asp.net core 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。

.net visual-studio visual-studio-2019
1个回答
0
投票

我有同样的问题后,安装新版本的Visual Studio 2019(16.6.0)。

在我的情况下,我通过从微软页面重新安装ASP.net核心3.1解决了这个问题。

例如,在下面的链接中。这个...

热门问题
推荐问题
最新问题