Quantcast
Channel: Xamarin.Mac — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 1429

sysdrawing-coregraphics with XM 4.5

$
0
0

@FrederikTheisen said:
I'm trying to convert my project from Xamarin.Mac mobile to Xamarin.Mac 4.5.
Now I get errors with drawing. When building it says that System.Drawing.Color is referenced multiple times and if I look at the System.Drawing and the OpenTK assemblies, they both contain a Color class. Did anyone else run into this?

I may be using the wrong System.Drawing assembly.

Minimal csproj: (from new test project)

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProjectGuid>{365A0970-BA60-446D-8C7E-D618EE51D3EB}</ProjectGuid>
    <ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <OutputType>Exe</OutputType>
    <RootNamespace>DrawingTestApp3</RootNamespace>
    <AssemblyName>DrawingTestApp3</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
    <UseXamMacFullFramework>true</UseXamMacFullFramework>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug</OutputPath>
    <DefineConstants>DEBUG;</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <EnableCodeSigning>false</EnableCodeSigning>
    <CodeSigningKey>Mac Developer</CodeSigningKey>
    <CreatePackage>false</CreatePackage>
    <EnablePackageSigning>false</EnablePackageSigning>
    <IncludeMonoRuntime>false</IncludeMonoRuntime>
    <UseSGen>true</UseSGen>
    <UseRefCounting>true</UseRefCounting>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <EnableCodeSigning>false</EnableCodeSigning>
    <CreatePackage>true</CreatePackage>
    <EnablePackageSigning>false</EnablePackageSigning>
    <IncludeMonoRuntime>true</IncludeMonoRuntime>
    <UseSGen>true</UseSGen>
    <UseRefCounting>true</UseRefCounting>
    <LinkMode>None</LinkMode>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="Xamarin.Mac" />
    <Reference Include="OpenTK">
      <HintPath>..\..\..\..\..\Library\Frameworks\Xamarin.Mac.framework\Versions\3.0.0.398\lib\reference\net_4_5\OpenTK.dll</HintPath>
    </Reference>
    <Reference Include="System.Drawing">
      <HintPath>..\..\..\Downloads\sysdrawing-coregraphics-Cycle6-2\mac\xm45\System.Drawing.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128.png" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128%402x.png" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16.png" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16%402x.png" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256.png" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256%402x.png" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32.png" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32%402x.png" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512.png" />
    <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512%402x.png" />
    <ImageAsset Include="Assets.xcassets\Contents.json" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Resources\" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Info.plist" />
    <None Include="Entitlements.plist" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Main.cs" />
    <Compile Include="AppDelegate.cs" />
    <Compile Include="ViewController.cs" />
    <Compile Include="ViewController.designer.cs">
      <DependentUpon>ViewController.cs</DependentUpon>
    </Compile>
    <Compile Include="DrawingView.cs" />
    <Compile Include="DrawingView.designer.cs">
      <DependentUpon>DrawingView.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <InterfaceDefinition Include="Main.storyboard" />
    <InterfaceDefinition Include="DrawingView.xib" />
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>

csproj from my actual project (same error with multiple Color types):

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProjectGuid>{DE253DD2-CB6A-4C18-A905-CE9B607F969A}</ProjectGuid>
    <ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <OutputType>Exe</OutputType>
    <RootNamespace>GeneViewerMac</RootNamespace>
    <AssemblyName>GeneViewer</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
    <UseXamMacFullFramework>true</UseXamMacFullFramework>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug</OutputPath>
    <DefineConstants>DEBUG;</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <EnableCodeSigning>false</EnableCodeSigning>
    <CodeSigningKey>Mac Developer</CodeSigningKey>
    <CreatePackage>false</CreatePackage>
    <EnablePackageSigning>false</EnablePackageSigning>
    <IncludeMonoRuntime>false</IncludeMonoRuntime>
    <UseSGen>true</UseSGen>
    <UseRefCounting>true</UseRefCounting>
    <Profiling>true</Profiling>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <EnableCodeSigning>false</EnableCodeSigning>
    <CreatePackage>true</CreatePackage>
    <EnablePackageSigning>false</EnablePackageSigning>
    <IncludeMonoRuntime>true</IncludeMonoRuntime>
    <UseSGen>true</UseSGen>
    <UseRefCounting>true</UseRefCounting>
    <LinkMode>None</LinkMode>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Net" />
    <Reference Include="System.Json" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Xml.Serialization" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Windows" />
    <Reference Include="System.Web.Services" />
    <Reference Include="System.IO.Compression.FileSystem" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.IO.Compression" />
    <Reference Include="System.ServiceModel.Web" />
    <Reference Include="System.Net.Http.WinHttpHandler" />
    <Reference Include="System.Data.Services.Client" />
    <Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
    <Reference Include="System.Security" />
    <Reference Include="Mono.Security" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="Xamarin.Mac" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="Mono.CSharp" />
    <Reference Include="Newtonsoft.Json">
      <HintPath>..\packages\Newtonsoft.Json.10.0.1\lib\netstandard1.3\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="System.Drawing">
      <HintPath>..\..\..\Downloads\sysdrawing-coregraphics-Cycle6-2\mac\xm45\System.Drawing.dll</HintPath>
    </Reference>
    <Reference Include="OpenTK">
      <HintPath>..\..\..\..\..\Library\Frameworks\Xamarin.Mac.framework\Versions\3.0.0.398\lib\reference\net_4_5\OpenTK.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Contents.json" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_128x128.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_128x128%402x.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_16x16.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_16x16%402x.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_256x256.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_256x256%402x.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_32x32.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_32x32%402x.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_512x512.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\Icon.iconset\icon_512x512%402x.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\AppIcon7.appiconset\Contents.json" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\AppIcon7.appiconset\16.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\AppIcon7.appiconset\32.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\AppIcon7.appiconset\64.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\AppIcon7.appiconset\128.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\AppIcon7.appiconset\256.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\AppIcon7.appiconset\512.png" />
    <ImageAsset Include="Resources\GeneViewerMac\Images.xcassets\AppIcon7.appiconset\1024.png" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Resources\" />
    <Folder Include="Resources\GeneViewerMac\Images.xcassets\AppIcon3.appiconset\" />
    <Folder Include="Resources\GeneViewerMac\Images.xcassets\AppIcon2.appiconset\" />
    <Folder Include="Resources\GeneViewerMac\Images.xcassets\AppIcon1.appiconset\" />
    <Folder Include="Resources\GeneViewerMac\Images.xcassets\Image01.imageset\" />
    <Folder Include="Resources\GeneViewerMac\Images.xcassets\AppIcon4.appiconset\" />
    <Folder Include="Resources\GeneViewerMac\Images.xcassets\AppIcon5.appiconset\" />
    <Folder Include="Resources\GeneViewerMac\Images.xcassets\AppIcon6.appiconset\" />
    <Folder Include="Resources\GeneViewerMac\Images.xcassets\AppIcon7.appiconset\" />
    <Folder Include="CrossPlatformFiles\" />
    <Folder Include="Data\" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Info.plist" />
    <None Include="Entitlements.plist" />
    <None Include="packages.config" />
    <None Include="CrossPlatformFiles\App_localservice.cs" />
    <None Include="CrossPlatformFiles\App_webservice.cs" />
    <None Include="OpenTK.dll.config" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Main.cs" />
    <Compile Include="App.cs" />
    <Compile Include="MainViewController.cs" />
    <Compile Include="MainViewController.designer.cs">
      <DependentUpon>MainViewController.cs</DependentUpon>
    </Compile>
    <Compile Include="NewDNAViewController.cs" />
    <Compile Include="NewDNAViewController.designer.cs">
      <DependentUpon>NewDNAViewController.cs</DependentUpon>
    </Compile>
    <Compile Include="CrossPlatformFiles\GeneViewerClasses.cs" />
    <Compile Include="MainWindowController.designer.cs">
      <DependentUpon>MainWindowController.cs</DependentUpon>
    </Compile>
    <Compile Include="MainSplitViewController.cs" />
    <Compile Include="MainSplitViewController.designer.cs">
      <DependentUpon>MainSplitViewController.cs</DependentUpon>
    </Compile>
    <Compile Include="ControlAssets\NSTextViewAsset.cs" />
    <Compile Include="ControlAssets\NSTextViewAsset.designer.cs">
      <DependentUpon>NSTextViewAsset.cs</DependentUpon>
    </Compile>
    <Compile Include="App.designer.cs">
      <DependentUpon>App.cs</DependentUpon>
    </Compile>
    <Compile Include="ControlAssets\MainWindowBrowser.cs" />
    <Compile Include="ControlAssets\MainWindowBrowser.designer.cs">
      <DependentUpon>MainWindowBrowser.cs</DependentUpon>
    </Compile>
    <Compile Include="NewDNAWindowController.designer.cs">
      <DependentUpon>NewDNAWindowController.cs</DependentUpon>
    </Compile>
    <Compile Include="NewDNAWindowController.cs" />
    <Compile Include="AnalyzerSettingsViewController.designer.cs">
      <DependentUpon>AnalyzerSettingsViewController.cs</DependentUpon>
    </Compile>
    <Compile Include="AnalyzerSettingsViewController.cs" />
    <Compile Include="AnalyzerSettingsWindowController.cs" />
    <Compile Include="AnalyzerSettingsWindowController.designer.cs">
      <DependentUpon>AnalyzerSettingsWindowController.cs</DependentUpon>
    </Compile>
    <Compile Include="AnalyzerViewController.cs" />
    <Compile Include="AnalyzerViewController.designer.cs">
      <DependentUpon>AnalyzerViewController.cs</DependentUpon>
    </Compile>
    <Compile Include="MainWindowController.cs" />
    <Compile Include="CrossPlatformFiles\dna_analyzerclass.cs" />
    <Compile Include="Resources\GeneViewerMac\DrawingView.cs" />
    <Compile Include="Resources\GeneViewerMac\DrawingView.designer.cs">
      <DependentUpon>DrawingView.cs</DependentUpon>
    </Compile>
    <Compile Include="PlasmidMapCircular.cs" />
    <Compile Include="PlasmidMapCircular.designer.cs">
      <DependentUpon>PlasmidMapCircular.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <InterfaceDefinition Include="Main.storyboard" />
  </ItemGroup>
  <ItemGroup>
    <BundleResource Include="Data\data_ntDict.txt" />
    <BundleResource Include="Data\data_RestrictionSites.xml" />
    <BundleResource Include="Data\data_ntCompDict.txt" />
    <BundleResource Include="Data\data_DNAFeatures.xml" />
    <BundleResource Include="Data\data_colorDict.txt" />
    <BundleResource Include="Data\data_codonDict.txt" />
    <BundleResource Include="Data\data_aminoAcidPropertiesXML.txt" />
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>

So I'm mixing two assemblies that are not compatible.

So I need to 'build' a new System.Drawing.dll for Xamarin cycle 9?

Is this System.Drawing approach even a reasonable choice for drawing simple 2D thing on screen?
This is what I'm using it for:


Viewing all articles
Browse latest Browse all 1429

Trending Articles