Skip to content

[BUG] Package does not work in VS2013 #1532

@bazilshep

Description

@bazilshep

Description

A Visual studio 2013 project referencing the package will not load.
The attribute "Kind" in element <NativeReference> is unrecognized.
If this one fixed, the next ItemGroup item property specified via an attribute will error.
The attribute "Dir" in element <_NativeSkiaSharpFile> is unrecognized. C:\proj\trunk\packages\SkiaSharp.2.80.2\build\net462\SkiaSharp.targets

This appears to be caused by VS2013 using an old MSBuild version that doesn't support the attribute syntax for setting item properties in the SkiaSharp.targets file. I'm still stuck with VS2013...

Related issue: #1466

Basic Information

  • Version with issue: 2.80.2
  • Last known good version: 1.68.1.1
  • IDE: Visual Studio 2103
  • Platform Target Frameworks:
    • Windows Classic

Workaround
Translating/replacing the Skaisharp.targets files with the old syntax appears to work. However, this means I can't just use the nuget package as-is.

See modified Skiasharp.targets file below:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <!-- if ShouldIncludeNativeSkiaSharp == False then don't include the native libSkiaSharp -->
    <PropertyGroup>
        <ShouldIncludeNativeSkiaSharp Condition=" '$(ShouldIncludeNativeSkiaSharp)' == '' ">True</ShouldIncludeNativeSkiaSharp>
        <_AppIsFullMac Condition=" '$(XamarinMacFrameworkRoot)' != '' and '$(TargetFrameworkIdentifier)' != 'Xamarin.Mac' and '$(UseXamMacFullFramework)' == 'True' and ('$(OutputType)' == 'Exe' or '$(IsAppExtension)' == 'True') ">True</_AppIsFullMac>
    </PropertyGroup>

	<!-- handle the case where this is a Xamarin.Mac Full app/extension -->
    <ItemGroup Condition=" '$(ShouldIncludeNativeSkiaSharp)' != 'False' and '$(_AppIsFullMac)' == 'True' ">
        <NativeReference Include="$(MSBuildThisFileDirectory)..\..\runtimes\osx\native\libSkiaSharp*.dylib">
                <Kind>Dynamic</Kind>
                <Visible>False</Visible>
        </NativeReference>
    </ItemGroup>

    <!-- copy the native files to the output directory -->
    <ItemGroup Condition=" '$(ShouldIncludeNativeSkiaSharp)' != 'False' and '$(_AppIsFullMac)' != 'True' ">

        <!-- Windows -->
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libSkiaSharp*.dll">
                <Dir>x86\</Dir>
        </_NativeSkiaSharpFile>
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\libSkiaSharp*.dll">
                <Dir>x64\</Dir>
        </_NativeSkiaSharpFile>
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64\native\libSkiaSharp*.dll">
                <Dir>arm64\</Dir>
        </_NativeSkiaSharpFile>

        <!-- Linux -->
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-x86\native\libSkiaSharp*.so">
                <Dir>x86\</Dir>
        </_NativeSkiaSharpFile>
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-x64\native\libSkiaSharp*.so">
                <Dir>x64\</Dir>
        </_NativeSkiaSharpFile>
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-arm\native\libSkiaSharp*.so">
                <Dir>arm\</Dir>
        </_NativeSkiaSharpFile>
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-arm64\native\libSkiaSharp*.so">
                <Dir>arm64\</Dir>
        </_NativeSkiaSharpFile>

        <!-- Linux: Musl -->
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-x86\native\libSkiaSharp*.so">
                <Dir>x86\</Dir>
        </_NativeSkiaSharpFile>
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-x64\native\libSkiaSharp*.so">
                <Dir>x64\</Dir>
        </_NativeSkiaSharpFile>
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-arm\native\libSkiaSharp*.so">
                <Dir>arm\</Dir>
        </_NativeSkiaSharpFile>
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-musl-arm64\native\libSkiaSharp*.so">
                <Dir>arm64\</Dir>
        </_NativeSkiaSharpFile>

        <!-- macOS -->
        <_NativeSkiaSharpFile Include="$(MSBuildThisFileDirectory)..\..\runtimes\osx\native\libSkiaSharp*.dylib" />

        <!-- include everything -->
        <Content Include="@(_NativeSkiaSharpFile)">
                <Link>%(Dir)%(Filename)%(Extension)</Link>
                <Visible>False</Visible>
                <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>

    </ItemGroup>

</Project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions