Publish: System.NullReferenceException: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.Docker.DotNetCore.DockerWorkspaceService.GetCurrentTargetOSAsync(IVsHierarchy hierarchy)
at Microsoft.VisualStudio.Web.Azure.Publish.AppServiceContainerProfileVisualFactory.<>c__DisplayClass24_1.<IsApplicableTo>b__0()
at Microsoft.VisualStudio.Threading.JoinableTaskFactory.ExecuteJob[T](Func`1 asyncMethod, JoinableTask job)
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
at Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run[T](Func`1 asyncMethod, JoinableTaskCreationOptions creationOptions)
at Microsoft.VisualStudio.Web.Azure.Publish.AppServiceContainerProfileVisualFactory.IsApplicableTo(IVsHierarchy hierarchy, IReadOnlyList`1& tags)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.LoadFactories(IPublishServiceProvider serviceProvider, IVsHierarchy hierarchy)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel..ctor(Dispatcher dispatcher, IAsyncServiceProvider vsServiceProvider, IPublishServiceProvider serviceProvider, IVsHierarchy hierarchy)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.Provider.DefaultPublishTabProvider.CreateViewAsync(IVsHierarchy project, IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken)
at Microsoft.VisualStudio.ApplicationCapabilities.Publish.Provider.ManagedPublishProvider.<CreateViewAsync>d__1.MoveNext()
Çözüm:
- Bu hatanın çözümü için Solution içerisinden “Dockerfile” isimli dosyaya sağ tıklayarak “Excude From Project” deyin
- Sonra Projenin içerisindeki “Properties” dizini içerisindeki her şeyi silin. (Herhangi bir ataya karşı öncesinde bu klasörü rarlayıp yedeklemenizi öneririm)
Devamında solution’ınızı baştan çalıştırın ve hatadan kurtulmuş olacaksınız.
İyi çalışmalar dilerim…