Reputation: 2052
I'am experimenting with Eto.Forms in VS for Mac. When I build, I receive the following errors:
System.Reflection.TargetInvocationException
and
Could not load file or assembly 'Xamarin.Mac, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' or one of its dependencies.
I assumed that this means I am missing a reference. However, Xamarin.Mac does not show up in the reference editor as well. Does anyone have an idea or any pointers for me?
The same solution works just fine when I run it in VS for Windows.
Added references are System, Eto and Eto.XamMac2 using the following code in Main:
[STAThread]
public static void Main(string[] args)
{
var platform = Eto.Platforms.XamMac2;
new Application(platform).Run(new MyForm());
}
Thanks
Upvotes: 2
Views: 502
Reputation: 1602
What you should do is create a Xamarin.Mac app and add Eto.XamMac2 to that. This allows you to debug the app and will bundle things properly using the Xamarin.Mac tooling. Here's how to do that (using latest VS for Mac):
Add Eto.XamMac2 and replace Main.Main() with the startup code:
var platform = Eto.Platforms.XamMac2;
new Application(platform).Run(new MyForm());
More details are here.
Upvotes: 0
Reputation: 2052
After some searching I found this VS plugin that sets up the solution for you: The dependency that I was missing was:
/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/Xamarin.Mac/Xamarin.Mac.dll
Upvotes: 0