Does Xamarin.mac Support GTK# User Interface

回眸只為那壹抹淺笑 提交于 2021-02-08 07:20:43

问题


I have an application coded with Mono.Mac using GTK# for the UI.I now have access to Xamarin.mac.Im trying to migrate the mono.mac solution to xamarin.mac. I'm trying copy-paste the code from mono.mac to a new xamarin.mac project,but there is no GUI builder in the Xamarin.mac project.So does Xamarin.mac support GTK#? Is there a better way i can migrate?

EDIT:

My goal is to bundle the mono runtime with the app package so that the user need not install it manually.


回答1:


MonoMac .csproj information:

First if you are not getting the upgrade to Xam.Mac dialog, it could be due to one or both of the following lines in your MonoMac project file:

<SuppressXamMacUpsell>True</SuppressXamMacUpsell>
<SuppressXamMacMigration>True</SuppressXamMacMigration>

If they exist, just edit the csproj file (right-click on project file: select Tools/Edit file), delete those lines, and save the file which should case an auto-project refresh, if no, close and reopen the solution/project.

Of course this assumes that the project is tagged as a MonoMac Type project in the csproj file.

At this point I would assume your project was originally created as a normal .Net project and you manually added MonoMac as a reference and thus XamStudio and xbuild would not see it as a 'special project type'.

Look for the ProjectTypeGuids tag in the project file:

The following is a C# / MonoMac project:

<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Assuming you only find the C# tag and not the MonoMac/Xam.Mac tag, I would change the project type and add MonoMac and then allow XamStudio to convert it to Xamarin.Mac (really just updating the guid and the MonoMac reference to XamMac)..

Current project:

<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Edit to:

<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

After XamMac conversion:

<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B 00C04F79EFBC}</ProjectTypeGuids>

At this point, your project should be seen as a XamMac type and the bundling from the menu, extra project options, etc. should now be exposed.

Standard C#/.Net project tag:

{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

Xamarin.Mac project tag:

{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23}

MonoMac project tag:

{948B3504-5B70-4649-8FE4-BDE1FB46EC69}


来源:https://stackoverflow.com/questions/32423984/does-xamarin-mac-support-gtk-user-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!