Browse Source

Don't reference platform-specific assemblies.

Instead of referencing platform-specific targets in the sample
applications, copy the libs in a build task
(Shared\perspex.platform.targets) - the correct lib will then be loaded
dynamically at runtime.
pull/83/head
Steven Kirk 11 years ago
parent
commit
c33adc416f
  1. 19
      samples/TestApplication/TestApplication.csproj
  2. 3
      samples/TestApplication/packages.config
  3. 28
      samples/XamlTestApplication/XamlTestApplication.csproj
  4. 3
      samples/XamlTestApplication/packages.config
  5. 20
      src/Shared/perspex.platform.targets

19
samples/TestApplication/TestApplication.csproj

@ -11,7 +11,8 @@
<AssemblyName>TestApplication</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>caf18def</NuGetPackageImportStamp>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -130,14 +131,6 @@
<Project>{3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}</Project>
<Name>Perspex.Themes.Default</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Windows\Perspex.Direct2D1\Perspex.Direct2D1.csproj">
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project>
<Name>Perspex.Direct2D1</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Windows\Perspex.Win32\Perspex.Win32.csproj">
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project>
<Name>Perspex.Win32</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="github_icon.png">
@ -145,13 +138,7 @@
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\SharpDX.2.6.3\build\SharpDX.targets" Condition="Exists('..\..\packages\SharpDX.2.6.3\build\SharpDX.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\SharpDX.2.6.3\build\SharpDX.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SharpDX.2.6.3\build\SharpDX.targets'))" />
</Target>
<Import Project="..\..\src\Shared\perspex.platform.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

3
samples/TestApplication/packages.config

@ -9,8 +9,5 @@
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="net45" />
<package id="Rx-XAML" version="2.2.5" targetFramework="net45" />
<package id="Serilog" version="1.5.9" targetFramework="net45" />
<package id="SharpDX" version="2.6.3" targetFramework="net45" />
<package id="SharpDX.Direct2D1" version="2.6.3" targetFramework="net45" />
<package id="SharpDX.DXGI" version="2.6.3" targetFramework="net45" />
<package id="Splat" version="1.6.2" targetFramework="net45" />
</packages>

28
samples/XamlTestApplication/XamlTestApplication.csproj

@ -68,18 +68,6 @@
<HintPath>..\..\packages\Serilog.1.5.9\lib\net45\Serilog.FullNetFx.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SharpDXPackageBinDir)\SharpDX.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Direct2D1, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SharpDXPackageBinDir)\SharpDX.Direct2D1.dll</HintPath>
</Reference>
<Reference Include="SharpDX.DXGI, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SharpDXPackageBinDir)\SharpDX.DXGI.dll</HintPath>
</Reference>
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Splat.1.6.2\lib\Net45\Splat.dll</HintPath>
<Private>True</Private>
@ -181,14 +169,6 @@
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project>
<Name>Perspex.Markup.Xaml</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Windows\Perspex.Direct2D1\Perspex.Direct2D1.csproj">
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project>
<Name>Perspex.Direct2D1</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Windows\Perspex.Win32\Perspex.Win32.csproj">
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project>
<Name>Perspex.Win32</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="github_icon.png">
@ -202,13 +182,7 @@
</Resource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\SharpDX.2.6.3\build\SharpDX.targets" Condition="Exists('..\..\packages\SharpDX.2.6.3\build\SharpDX.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\SharpDX.2.6.3\build\SharpDX.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SharpDX.2.6.3\build\SharpDX.targets'))" />
</Target>
<Import Project="..\..\src\Shared\perspex.platform.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

3
samples/XamlTestApplication/packages.config

@ -14,9 +14,6 @@
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="net46" />
<package id="Rx-XAML" version="2.2.5" targetFramework="net46" />
<package id="Serilog" version="1.5.9" targetFramework="net46" />
<package id="SharpDX" version="2.6.3" targetFramework="net46" />
<package id="SharpDX.Direct2D1" version="2.6.3" targetFramework="net46" />
<package id="SharpDX.DXGI" version="2.6.3" targetFramework="net46" />
<package id="Splat" version="1.6.2" targetFramework="net46" />
<package id="Sprache" version="2.0.0.46" targetFramework="net46" />
<package id="Sprache.SuperJMN" version="2.0.0.46" targetFramework="net46" />

20
src/Shared/perspex.platform.targets

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Includes the Perspex platform-specific libraries in an application's output directory -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="'$(MSBuildThisFileDirectory)' != '' And HasTrailingSlash('$(MSBuildThisFileDirectory)')">
<PlatformLib Include="$(MSBuildThisFileDirectory)..\Gtk\Perspex.Cairo\bin\$(Configuration)\Perspex.Cairo.dll" />
<PlatformLib Include="$(MSBuildThisFileDirectory)..\Gtk\Perspex.Gtk\bin\$(Configuration)\Perspex.Gtk.dll" />
<PlatformLib Include="$(MSBuildThisFileDirectory)..\Windows\Perspex.Direct2D1\bin\$(Configuration)\Perspex.Direct2D1.dll" />
<PlatformLib Include="$(MSBuildThisFileDirectory)..\Windows\Perspex.Direct2D1\bin\$(Configuration)\SharpDX.dll" />
<PlatformLib Include="$(MSBuildThisFileDirectory)..\Windows\Perspex.Direct2D1\bin\$(Configuration)\SharpDX.Direct2D1.dll" />
<PlatformLib Include="$(MSBuildThisFileDirectory)..\Windows\Perspex.Direct2D1\bin\$(Configuration)\SharpDX.DXGI.dll" />
<PlatformLib Include="$(MSBuildThisFileDirectory)..\Windows\Perspex.Win32\bin\$(Configuration)\Perspex.Win32.dll" />
</ItemGroup>
<PropertyGroup>
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);CopyPlatformLibs</PrepareForRunDependsOn>
</PropertyGroup>
<Target Name="CopyPlatformLibs">
<Copy SourceFiles="@(PlatformLib)" DestinationFolder="$(OutDir)" ContinueOnError="true"/>
</Target>
</Project>
Loading…
Cancel
Save