简体   繁体   中英

VS 2019 not building Solution for new projects

I updated VS 2019 yesterday and today i am trying to create new projects for asp.net core web application, project is created but when i build solution or try to run solution i keep getting following error.

Error   MSB4018 The "ResolveTargetingPackAssets" task failed unexpectedly.

complete error details

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 

Old project i am able to run, problem seems to be only with new project which i create.

Could this be due to VS update which i did yesterday

I had the same problem after the install the new version of Visual Studio 2019 (16.6.0).

In my case, I solved it by REINSTALLING the ASP.net core 3.1 from Microsoft page.

For example, in the following link: this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM