在迁移之后,我的XamarinForm项目使用共享.net starddard项目而不是pcl(以下链接https://blog.xamarin.com/building-xamarin-forms-apps-net-standard/)
当我右键单击共享项目(.net stardard proj)使用Prism ViewModel使用Prism模板包创建Xamarin.Forms ContentPage时出现此错误:
项目系统遇到错误。 你调用的对象是空的。 诊断日志已写入以下位置:“C:\ Users \ toumir \ AppData \ Local \ Temp \ VsProjectFault_7c3ce3c8-085f-4531-99cf-85d9a8b8ceee.failure.txt”。
日志文件内容
04-09-2017 09:05:10
Recoverable
System.NullReferenceException: Object reference not set to an instance of an object.
at Prism.VisualStudio.Wizards.CreateViewModelForViewWizard.RunFinished()
at Microsoft.VisualStudio.TemplateWizard.Wizard.Execute(Object application, Int32 hwndOwner, Object[]& ContextParams, Object[]& CustomParams, wizardResult& retval)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.RunWizard(SimpleHierarchyNode parentNode, String itemName, String wizardToRun, IntPtr dlgOwner)
at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<AddItemWithSpecificAsync>d__602.MoveNext()
--- 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.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass468_0.<<AddItem>b__0>d.MoveNext()
--- 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.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously[T](Func`1 asyncAction)
at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass559_0.<HrInvoke>b__0()
at Microsoft.VisualStudio.ProjectSystem.VS.HResult.Invoke(Func`1 action, IServiceProvider vsShellServiceProvider, IProjectFaultHandlerService projectFaultHandlerService, UnconfiguredProject project)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>b__0()
at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
以及显示此消息的另一个消息框:
“对象引用未设置为对象的实例。”
仅供参考:
任何人都可以指导我们吗? 提前谢谢
答案 0 :(得分:2)
Prism Template Pack目前尚未正式支持.NET Standard项目格式。 Xamarin不附带任何.NET Standard兼容项目模板,Xamarin本身不是.NET Standard。当Xamarin更新为.NET Standard时,Prism模板包将随之而来。