C# System.IO.FileNotFoundException:在InitializeComponent上由自己的控件引起
我在创建自己的控件时遇到问题:我试图使网格视图类似于列表视图。问题出在页面的xaml文件中——当我初始化我的组件应用程序时,该页面上的应用程序崩溃,文件未找到异常 错误说明:System.IO.FileNotFoundException无法加载文件或程序集“FastFood”或其依赖项之一。系统不能 查找指定的文件 调用堆栈:C# System.IO.FileNotFoundException:在InitializeComponent上由自己的控件引起,c#,ios,xamarin,xamarin.forms,C#,Ios,Xamarin,Xamarin.forms,我在创建自己的控件时遇到问题:我试图使网格视图类似于列表视图。问题出在页面的xaml文件中——当我初始化我的组件应用程序时,该页面上的应用程序崩溃,文件未找到异常 错误说明:System.IO.FileNotFoundException无法加载文件或程序集“FastFood”或其依赖项之一。系统不能 查找指定的文件 调用堆栈: _at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Sec
_at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity)
[0x00081]英寸
/Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/AppDomain.cs:706
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in
/Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/AppDomain.cs:674
at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in
/Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/Assembly.cs:551
at Xamarin.Forms.Xaml.XamlParser.GetElementType (Xamarin.Forms.Xaml.XmlType xmlType, IXmlLineInfo xmlInfo,
System.Reflection.Assembly当前组件,
0中的Xamarin.Forms.Xaml.XamlParseException和exception)[0x00133]
在Xamarin.Forms.Xaml.CreateValuesVisitor.Visit(Xamarin.Forms.Xaml.ElementNode节点,INode parentNode)[0x0002a]中
:0
在Xamarin.Forms.Xaml.ElementNode.Accept(IXamlNodeVisitor访问者,INode parentNode)[0x000b1]中:0
在:0中的Xamarin.Forms.Xaml.ElementNode.Accept(IXamlNodeVisitor访问者,INode parentNode)[0x00089]处
在Xamarin.Forms.Xaml.RootNode.Accept(IXamlNodeVisitor访问者,INode parentNode)[0x00064]中:0
在中的Xamarin.Forms.Xaml.XamlLoader.Load(Xamarin.Forms.BindableObject视图,System.String Xaml)[0x000a4]处
:0
在Xamarin.Forms.Xaml.XamlLoader.Load(Xamarin.Forms.BindableObject视图,System.Type callingType)[0x0002e]
年:0
0中的Xamarin.Forms.Xaml.Extensions.LoadFromXaml[CategoryPage](FastFood.CategoryPage视图,System.Type callingType)[0x00000]处
在/Users/Slider/Coffetab/iOS/obj/iPhoneSimulator/Debug/FastFood.iOS..Users.Slider.Coffetab.FastFood.CategoryPage.xaml.g.cs:33中的FastFood.CategoryPage.InitializeComponent()[0x0000c]
at FastFood.CategoryPage..ctor () [0x0001a] in /Users/Slider/Coffetab/FastFood/CategoryPage.xaml.cs:25
at FastFood.MenuPage..ctor () [0x0004b] in /Users/Slider/Coffetab/FastFood/MenuPage.xaml.cs:14
at FastFood.MainPage.OnLogin (System.Object sender, System.EventArgs e) [0x0002f] in
/Users/Slider/Coffetab/FastFood/MainPage.xaml.cs:29
在Xamarin.Forms.Button.Xamarin.Forms.IButtonController.SendClicked()处
[0x00020]输入:0
位于Xamarin.Forms.Platform.iOS.ButtonRenderer.onbuttonTouchInside(System.Object sender,System.EventArgs EventArgs)[0x0000e]中:0
在/Users/builder/data/lanes/2320/1f068b49/source/maccore/src/UIKit/UIControl中的UIKit.UIControlEventProxy.Activated()[0x00007]处。cs:37
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in
/Users/builder/data/lanes/2320/1f068b49/source/maccore/src/UIKit/UIApplication.cs:77
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in
/Users/builder/data/lanes/2320/1f068b49/source/maccore/src/UIKit/UIApplication.cs:61
at FastFood.iOS.Application.Main (System.String[] args) [0x0001a] in /Users/Slider/Coffetab/iOS/Main.cs:23_
我做错了什么?几年后(为你),但我在论坛上找到了解决方案
我曾在其他组件和NuGet中遇到过这种情况
包装。你可能不得不接受这样一个事实:你必须
包括实例化ExtendedSlider的伪代码行。信息技术
不需要做任何事情,只要在某个地方引用就行了
当您仅在XAML中使用它时,编译器不会检测到
引用,从而排除所需的dll。直到世界的创造者
组件找到了一些修复方法,您必须使用此解决方法
资料来源:
因此,只需从AssemblyInQuestion()中添加一个随机var foo=new yourcomponents代码>代码中的任何地方,它都不应该再抱怨了
也许这会帮助其他人以后像我一样在同样的问题上绊倒