gpt4 book ai didi

c# - 将 'Xamarin.Forms' 添加到 ... 对象引用未设置为对象的实例。添加 nuget 包时出现错误

转载 作者:行者123 更新时间:2023-11-30 23:32:15 25 4
gpt4 key购买 nike

我正在使用 Windows10,并安装了 VS2015,我最初尝试在其上运行 Xamarin,但是由于 1k 的许可证成本,我现在正在尝试使用 Xamarin Studio , 运气不好。我真的创建了空白项目并尝试构建它并丢失了 Xamarin.Forms 引用,当我尝试通过 nuget 添加它时我得到以下信息:

Adding Xamarin.Forms... WARNING: Xamarin.Forms Package contains PowerShell scripts which will not be run. Installing 'Xamarin.Forms 2.0.0.6490'. Added file 'ICSharpCode.Decompiler.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'ICSharpCode.NRefactory.Cecil.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'ICSharpCode.NRefactory.CSharp.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'ICSharpCode.NRefactory.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'ICSharpCode.NRefactory.Xml.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Mono.Cecil.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Mono.Cecil.Mdb.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Mono.Cecil.Pdb.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Mono.Cecil.Rocks.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Xamarin.Forms.Build.Tasks.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Xamarin.Forms.targets' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'FormsViewGroup.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10'. Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10'. Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10'. Added file 'Xamarin.Forms.Platform.Android.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10'. Added file 'Xamarin.Forms.Platform.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10'. Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10'. Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10'. Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoTouch10'. Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoTouch10'. Added file 'Xamarin.Forms.Platform.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoTouch10'. Added file 'Xamarin.Forms.Platform.iOS.Classic.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoTouch10'. Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoTouch10'. Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\MonoTouch10'. Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Xamarin.Forms.Platform.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10'. Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0'. Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0'. Added file 'Xamarin.Forms.Platform.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0'. Added file 'Xamarin.Forms.Platform.UAP.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0'. Added file 'Xamarin.Forms.Platform.UAP.pri' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0'. Added file 'FormsTextBox.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0\Xamarin.Forms.Platform.UAP'. Added file 'PageControl.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0\Xamarin.Forms.Platform.UAP'. Added file 'Xamarin.Forms.Platform.UAP.rd.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0\Xamarin.Forms.Platform.UAP\Properties'. Added file 'Resources.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0\Xamarin.Forms.Platform.UAP'. Added file 'Xamarin.Forms.Platform.UAP.xr.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0\Xamarin.Forms.Platform.UAP'. Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0'. Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\uap10.0'. Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81'. Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81'. Added file 'Xamarin.Forms.Platform.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81'. Added file 'Xamarin.Forms.Platform.WinRT.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81'. Added file 'Xamarin.Forms.Platform.WinRT.pri' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81'. Added file 'Xamarin.Forms.Platform.WinRT.Tablet.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81'. Added file 'Xamarin.Forms.Platform.WinRT.Tablet.pri' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81'. Added file 'Resources.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81\Xamarin.Forms.Platform.WinRT.Tablet'. Added file 'TabletResources.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81\Xamarin.Forms.Platform.WinRT.Tablet'. Added file 'Xamarin.Forms.Platform.WinRT.Tablet.xr.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81\Xamarin.Forms.Platform.WinRT.Tablet'. Added file 'FormsTextBox.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81\Xamarin.Forms.Platform.WinRT'. Added file 'PageControl.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81\Xamarin.Forms.Platform.WinRT'. Added file 'StepperControl.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81\Xamarin.Forms.Platform.WinRT'. Added file 'Xamarin.Forms.Platform.WinRT.xr.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81\Xamarin.Forms.Platform.WinRT'. Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81'. Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\win81'. Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\WP80'. Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\WP80'. Added file 'Xamarin.Forms.Platform.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\WP80'. Added file 'Xamarin.Forms.Platform.WP8.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\WP80'. Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\WP80'. Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\WP80'. Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81'. Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81'. Added file 'Xamarin.Forms.Platform.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81'. Added file 'Xamarin.Forms.Platform.WinRT.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81'. Added file 'Xamarin.Forms.Platform.WinRT.Phone.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81'. Added file 'Xamarin.Forms.Platform.WinRT.Phone.pri' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81'. Added file 'PhoneResources.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone'. Added file 'Resources.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone'. Added file 'SearchBox.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone'. Added file 'Xamarin.Forms.Platform.WinRT.Phone.xr.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone'. Added file 'Xamarin.Forms.Platform.WinRT.pri' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81'. Added file 'FormsTextBox.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81\Xamarin.Forms.Platform.WinRT'. Added file 'PageControl.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81\Xamarin.Forms.Platform.WinRT'. Added file 'StepperControl.xbf' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81\Xamarin.Forms.Platform.WinRT'. Added file 'Xamarin.Forms.Platform.WinRT.xr.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81\Xamarin.Forms.Platform.WinRT'. Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81'. Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\wpa81'. Added file 'Xamarin.Forms.Core.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\Xamarin.iOS10'. Added file 'Xamarin.Forms.Core.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\Xamarin.iOS10'. Added file 'Xamarin.Forms.Platform.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\Xamarin.iOS10'. Added file 'Xamarin.Forms.Platform.iOS.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\Xamarin.iOS10'. Added file 'Xamarin.Forms.Xaml.dll' to folder 'Xamarin.Forms.2.0.0.6490\lib\Xamarin.iOS10'. Added file 'Xamarin.Forms.Xaml.xml' to folder 'Xamarin.Forms.2.0.0.6490\lib\Xamarin.iOS10'. Added file 'init.ps1' to folder 'Xamarin.Forms.2.0.0.6490\tools'. Added file 'Xamarin.Forms.Core.Design.dll' to folder 'Xamarin.Forms.2.0.0.6490\tools'. Added file 'Xamarin.Forms.Xaml.Design.dll' to folder 'Xamarin.Forms.2.0.0.6490\tools'. Added file 'Xamarin.Forms.2.0.0.6490.nupkg' to folder 'Xamarin.Forms.2.0.0.6490'. Successfully installed 'Xamarin.Forms 2.0.0.6490'. Adding 'Xamarin.Forms 2.0.0.6490' to EmergencyAssistanceResponseSystem. Object reference not set to an instance of an object.

从最后几行来看,它似乎得到了 nuget,因为它舒适地坐在 packages/Xamarin.Forms.2.0.0.6490 中,但是由于某种原因未能在项目中引用 将“Xamarin.Forms 2.0.0.6490”添加到 EmergencyAssistanceResponseSystem。
对象引用未设置到对象的实例。

我该如何进一步调试它,因为很明显缺少一些引用,但是在哪里和什么?

编辑 1:事实上,在我的日志文件中(C:\Users\[User]\AppData\Local\XamarinStudio-5.0\Logs)我能够找到以下内容:

Could not add Xamarin.Forms.
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.NetPortableProfileTable.GetProfile(String profileName)
at NuGet.NetPortableProfile.Parse(String profileValue, Boolean treatOptionalFrameworksAsSupportedFrameworks)
at NuGet.VersionUtility.IsPortableLibraryCompatible(FrameworkName projectFrameworkName, FrameworkName packageTargetFrameworkName)
at NuGet.VersionUtility.IsCompatible(FrameworkName projectFrameworkName, FrameworkName packageTargetFrameworkName)
at NuGet.VersionUtility.<>c__DisplayClass19`1.<TryGetCompatibleItems>b__13(IGrouping`2 g)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at NuGet.VersionUtility.TryGetCompatibleItems[T](FrameworkName projectFramework, IEnumerable`1 items, IEnumerable`1& compatibleItems)
at NuGet.ProjectSystemExtensions.GetCompatibleItemsCore[T](IProjectSystem projectSystem, IEnumerable`1 items)
at NuGet.ProjectManager.ExtractPackageFilesToProject(IPackage package)
at NuGet.ProjectManager.AddPackageReferenceToProject(IPackage package)
at NuGet.ProjectManager.Execute(PackageOperation operation)
at NuGet.ProjectManager.Execute(IPackage package, IPackageOperationResolver resolver)
at NuGet.ProjectManager.AddPackageReference(IPackage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
at NuGet.ProjectManager.AddPackageReference(String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
at ICSharpCode.PackageManagement.SharpDevelopPackageManager.AddPackageReference(IPackage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
at ICSharpCode.PackageManagement.SharpDevelopPackageManager.InstallPackage(IPackage package, InstallPackageAction installAction)
at ICSharpCode.PackageManagement.PackageManagementProject.InstallPackage(IPackage package, InstallPackageAction installAction)
at ICSharpCode.PackageManagement.InstallPackageAction.ExecuteCore()
at ICSharpCode.PackageManagement.ProcessPackageAction.Execute()
at MonoDevelop.PackageManagement.BackgroundPackageActionRunner.RunActionsWithProgressMonitor(IProgressMonitor monitor, IList`1 packageActions)
at MonoDevelop.PackageManagement.BackgroundPackageActionRunner.RunActionsWithProgressMonitor(ProgressMonitorStatusMessage progressMessage, IList`1 installPackageActions)

最佳答案

如果引用有问题,在你的项目文件夹中会有“Package”文件夹,使用 Xamarin studio 你可以手动添加 dll,这样做:

  1. 右键单击 Reference 文件夹(在每个平台上)
  2. 点击“编辑引用资料”
  3. 导航到名为“.Net Assembly”的选项卡
  4. 浏览到项目中的包文件夹并添加缺少的特定 .dll。

注意:如果包文件夹不包含您正在寻找的 block ,您可以从您已经下载的其他项目中添加 dll,然后您将能够编译。希望这会有所帮助。

关于c# - 将 'Xamarin.Forms' 添加到 ... 对象引用未设置为对象的实例。添加 nuget 包时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34358166/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com