Skip to content

Commit

Permalink
Nupkg Restructure
Browse files Browse the repository at this point in the history
Resolves #2156

Nuget packages updated to use ItemGroup None instead of Copy target
Nuget props restructure to support Win32 target
x86 and Win32 targets are exactly the same in content, they differ in name only, so switched to using an <Otherwise/> block
Remove AnyCpu <When/> option from props files and consolidate with x86 and Win32. Set Private to false and rely on the
<None/> entires to copy the files to the output folder

Ideally would move the OffScreen, WinForms and WPF targets file content to the props (as they're actually props now), unfortunately
we need guaranteed ordering and Nuget 2.8.x doesn't provide that, if we leave them as .targets it'll happen late enough to make sure
the cef.redist list of files is provided.
NuGet/Home#4229 (comment)
  • Loading branch information
amaitland committed Jan 23, 2018
1 parent ebaa81f commit 6cb98ec
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 101 deletions.
21 changes: 5 additions & 16 deletions NuGet/CefSharp.Common.props
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<When Condition="'$(Platform)' == 'x86'">
<ItemGroup>
<Reference Include="CefSharp">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CefSharp.Core">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'x64'">
<ItemGroup>
<Reference Include="CefSharp">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="CefSharp.Core">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.Core.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'AnyCPU'">
<!-- x86, Win32 and AnyCpu -->
<Otherwise>
<ItemGroup>
<Reference Include="CefSharp">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.dll</HintPath>
Expand All @@ -36,6 +25,6 @@
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Otherwise>
</Choose>
</Project>
69 changes: 42 additions & 27 deletions NuGet/CefSharp.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,53 @@
<ItemGroup>
<CefSharpCommonBinaries32 Include="$(MSBuildThisFileDirectory)..\CefSharp\x86\*.*" />
<CefSharpCommonBinaries64 Include="$(MSBuildThisFileDirectory)..\CefSharp\x64\*.*" />
<CefSharpCommonBinariesAnyCpu Include="$(MSBuildThisFileDirectory)..\CefSharp\**\*.*" />
</ItemGroup>

<PropertyGroup>
<CefSharpTargetDir Condition=" '$(CefSharpTargetDir)' == '' ">$(TargetDir)</CefSharpTargetDir>
<CefSharpTargetDir Condition=" '$(CefSharpTargetDir)' == '' "></CefSharpTargetDir>
</PropertyGroup>

<Target Name="CefSharpCopyLibs86" BeforeTargets="BeforeBuild" Condition="('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<Message Importance="high" Text="Copying cef.redist x86 files" />
<Copy SourceFiles="@(CefRedist32)" DestinationFiles="@(CefRedist32->'$(CefSharpTargetDir)\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />

<Message Importance="high" Text="-- CefSharp.Common.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x86 to $(CefSharpTargetDir)" />
<Copy SourceFiles="@(CefSharpCommonBinaries32)" DestinationFolder="$(CefSharpTargetDir)" SkipUnchangedFiles="true" />
</Target>

<Target Name="CefSharpCopyLibs64" BeforeTargets="BeforeBuild" Condition="'$(Platform)' == 'x64'">
<Message Importance="high" Text="Copying cef.redist x64 files" />
<Copy SourceFiles="@(CefRedist64)" DestinationFiles="@(CefRedist64->'$(CefSharpTargetDir)\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />

<Message Importance="high" Text="-- CefSharp.Common.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x64 to $(CefSharpTargetDir)" />
<Copy SourceFiles="@(CefSharpCommonBinaries64)" DestinationFolder="$(CefSharpTargetDir)" SkipUnchangedFiles="true" />
</Target>

<Target Name="CefSharpCopyLibsAnyCPU" BeforeTargets="BeforeBuild" Condition="'$(Platform)' == 'AnyCPU'">
<Message Importance="high" Text="Copying cef.redist x86 files" />
<Copy SourceFiles="@(CefRedist32)" DestinationFiles="@(CefRedist32->'$(CefSharpTargetDir)\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
<!--
These item groups should be in the .props file, unfortunately Nuget 2.8.x doesn't gurantee the
correct ordering .props imports, which we require as this depends on the cef.redist packages
exporting an ItemGroup
-->

<ItemGroup Condition="('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<None Include="@(CefRedist32)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="@(CefSharpCommonBinaries32)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<Message Importance="high" Text="Copying cef.redist x64 files" />
<Copy SourceFiles="@(CefRedist64)" DestinationFiles="@(CefRedist64->'$(CefSharpTargetDir)\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
<ItemGroup Condition="'$(Platform)' == 'x64'">
<None Include="@(CefRedist64)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="@(CefSharpCommonBinaries64)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<Message Importance="high" Text="-- CefSharp.Common.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x86 to $(CefSharpTargetDir)\x86" />
<Copy SourceFiles="@(CefSharpCommonBinaries32)" DestinationFolder="$(CefSharpTargetDir)\x86" SkipUnchangedFiles="true" />
<Message Importance="high" Text="-- CefSharp.Common.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x64 to $(CefSharpTargetDir)\x64" />
<Copy SourceFiles="@(CefSharpCommonBinaries64)" DestinationFolder="$(CefSharpTargetDir)\x64" SkipUnchangedFiles="true" />
</Target>
<ItemGroup Condition="'$(Platform)' == 'AnyCPU'">
<None Include="@(CefRedist32)">
<Link>$(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="@(CefRedist64)">
<Link>$(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="@(CefSharpCommonBinariesAnyCpu)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
15 changes: 4 additions & 11 deletions NuGet/CefSharp.OffScreen.props
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<When Condition="'$(Platform)' == 'x86'">
<ItemGroup>
<Reference Include="CefSharp.OffScreen">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.OffScreen.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'x64'">
<ItemGroup>
<Reference Include="CefSharp.OffScreen">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.OffScreen.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'AnyCPU'">
<!-- x86, Win32 and AnyCpu -->
<Otherwise>
<ItemGroup>
<Reference Include="CefSharp.OffScreen">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.OffScreen.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Otherwise>
</Choose>
</Project>
48 changes: 39 additions & 9 deletions NuGet/CefSharp.OffScreen.targets
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CefSharpTargetDir Condition=" '$(CefSharpTargetDir)' == '' ">$(TargetDir)</CefSharpTargetDir>
<CefSharpTargetDir Condition=" '$(CefSharpTargetDir)' == '' "></CefSharpTargetDir>
</PropertyGroup>

<ItemGroup>
<CefSharpOffscreenBinaries32 Include="$(MSBuildThisFileDirectory)..\CefSharp\x86\*.*" />
<CefSharpOffscreenBinaries64 Include="$(MSBuildThisFileDirectory)..\CefSharp\x64\*.*" />
<CefSharpOffScreenBinaries32 Include="$(MSBuildThisFileDirectory)..\CefSharp\x86\*.*" />
<CefSharpOffScreenBinaries64 Include="$(MSBuildThisFileDirectory)..\CefSharp\x64\*.*" />
<!-- Not currently used, might come in handy for someone though as it contains all x86 and x64 files -->
<CefSharpOffscreenBinariesAnyCpu Include="$(MSBuildThisFileDirectory)..\CefSharp\**\*.*" />
</ItemGroup>

<Target Name="CefSharpCopyOffScreenAnyCPU" BeforeTargets="BeforeBuild" Condition="'$(Platform)' == 'AnyCPU'">
<Message Importance="high" Text="-- CefSharp.OffScreen.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x86 to $(CefSharpTargetDir)\x86" />
<Copy SourceFiles="@(CefSharpOffscreenBinaries32)" DestinationFolder="$(CefSharpTargetDir)\x86" SkipUnchangedFiles="true" />
<Message Importance="high" Text="-- CefSharp.OffScreen.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x64 to $(CefSharpTargetDir)\x64" />
<Copy SourceFiles="@(CefSharpOffscreenBinaries64)" DestinationFolder="$(CefSharpTargetDir)\x64" SkipUnchangedFiles="true" />
</Target>
<!--
These item groups should be in the .props file, unfortunately Nuget 2.8.x doesn't gurantee the
correct ordering .props imports, which we require as this depends on the cef.redist packages
exporting an ItemGroup
-->

<!-- Copying all files here included those at are added As References so you can specify CefSharpTargetDir -->
<Choose>
<When Condition="'$(Platform)' == 'AnyCpu'">
<ItemGroup>
<None Include="@(CefSharpOffscreenBinariesAnyCpu)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'x64'">
<ItemGroup>
<None Include="@(CefSharpOffScreenBinaries64)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</When>
<!-- x86, and Win32 -->
<Otherwise>
<ItemGroup>
<None Include="@(CefSharpOffScreenBinaries32)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Otherwise>
</Choose>
</Project>
15 changes: 4 additions & 11 deletions NuGet/CefSharp.WinForms.props
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<When Condition="'$(Platform)' == 'x86'">
<ItemGroup>
<Reference Include="CefSharp.WinForms">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.WinForms.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'x64'">
<ItemGroup>
<Reference Include="CefSharp.WinForms">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.WinForms.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'AnyCPU'">
<!-- x86, Win32 and AnyCpu -->
<Otherwise>
<ItemGroup>
<Reference Include="CefSharp.WinForms">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.WinForms.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Otherwise>
</Choose>
</Project>
46 changes: 38 additions & 8 deletions NuGet/CefSharp.WinForms.targets
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CefSharpTargetDir Condition=" '$(CefSharpTargetDir)' == '' ">$(TargetDir)</CefSharpTargetDir>
<CefSharpTargetDir Condition=" '$(CefSharpTargetDir)' == '' "></CefSharpTargetDir>
</PropertyGroup>

<ItemGroup>
<CefSharpWinFormsBinaries32 Include="$(MSBuildThisFileDirectory)..\CefSharp\x86\*.*" />
<CefSharpWinFormsBinaries64 Include="$(MSBuildThisFileDirectory)..\CefSharp\x64\*.*" />
<!-- Not currently used, might come in handy for someone though as it contains all x86 and x64 files -->
<CefSharpWinFormsBinariesAnyCpu Include="$(MSBuildThisFileDirectory)..\CefSharp\**\*.*" />
</ItemGroup>

<Target Name="CefSharpCopyWinFormsAnyCPU" BeforeTargets="BeforeBuild" Condition="'$(Platform)' == 'AnyCPU'">
<Message Importance="high" Text="-- CefSharp.WinForms.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x86 to $(CefSharpTargetDir)\x86" />
<Copy SourceFiles="@(CefSharpWinFormsBinaries32)" DestinationFolder="$(CefSharpTargetDir)\x86" SkipUnchangedFiles="true" />
<Message Importance="high" Text="-- CefSharp.WinForms.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x64 to $(CefSharpTargetDir)\x64" />
<Copy SourceFiles="@(CefSharpWinFormsBinaries64)" DestinationFolder="$(CefSharpTargetDir)\x64" SkipUnchangedFiles="true" />
</Target>

<!--
These item groups should be in the .props file, unfortunately Nuget 2.8.x doesn't gurantee the
correct ordering .props imports, which we require as this depends on the cef.redist packages
exporting an ItemGroup
-->

<!-- Copying all files here included those at are added As References so you can specify CefSharpTargetDir -->
<Choose>
<When Condition="'$(Platform)' == 'AnyCpu'">
<ItemGroup>
<None Include="@(CefSharpWinFormsBinariesAnyCpu)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'x64'">
<ItemGroup>
<None Include="@(CefSharpWinFormsBinaries64)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</When>
<!-- x86, and Win32 -->
<Otherwise>
<ItemGroup>
<None Include="@(CefSharpWinFormsBinaries32)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Otherwise>
</Choose>
</Project>
15 changes: 4 additions & 11 deletions NuGet/CefSharp.Wpf.props
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<When Condition="'$(Platform)' == 'x86'">
<ItemGroup>
<Reference Include="CefSharp.Wpf">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Wpf.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'x64'">
<ItemGroup>
<Reference Include="CefSharp.Wpf">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.Wpf.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'AnyCPU'">
<!-- x86, Win32 and AnyCpu -->
<Otherwise>
<ItemGroup>
<Reference Include="CefSharp.Wpf">
<HintPath>$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Wpf.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Otherwise>
</Choose>
</Project>
46 changes: 38 additions & 8 deletions NuGet/CefSharp.Wpf.targets
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CefSharpTargetDir Condition=" '$(CefSharpTargetDir)' == '' ">$(TargetDir)</CefSharpTargetDir>
<CefSharpTargetDir Condition=" '$(CefSharpTargetDir)' == '' "></CefSharpTargetDir>
</PropertyGroup>

<ItemGroup>
<CefSharpWpfBinaries32 Include="$(MSBuildThisFileDirectory)..\CefSharp\x86\*.*" />
<CefSharpWpfBinaries64 Include="$(MSBuildThisFileDirectory)..\CefSharp\x64\*.*" />
<!-- Not currently used, might come in handy for someone though as it contains all x86 and x64 files -->
<CefSharpWpfBinariesAnyCpu Include="$(MSBuildThisFileDirectory)..\CefSharp\**\*.*" />
</ItemGroup>

<Target Name="CefSharpCopyWpfAnyCPU" BeforeTargets="BeforeBuild" Condition="'$(Platform)' == 'AnyCPU'">
<Message Importance="high" Text="-- CefSharp.Wpf.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x86 to $(CefSharpTargetDir)\x86" />
<Copy SourceFiles="@(CefSharpWpfBinaries32)" DestinationFolder="$(CefSharpTargetDir)\x86" SkipUnchangedFiles="true" />
<Message Importance="high" Text="-- CefSharp.Wpf.targets: Copying files from $(MSBuildThisFileDirectory)..\CefSharp\x64 to $(CefSharpTargetDir)\x64" />
<Copy SourceFiles="@(CefSharpWpfBinaries64)" DestinationFolder="$(CefSharpTargetDir)\x64" SkipUnchangedFiles="true" />
</Target>

<!--
These item groups should be in the .props file, unfortunately Nuget 2.8.x doesn't gurantee the
correct ordering .props imports, which we require as this depends on the cef.redist packages
exporting an ItemGroup
-->

<!-- Copying all files here included those at are added As References so you can specify CefSharpTargetDir -->
<Choose>
<When Condition="'$(Platform)' == 'AnyCpu'">
<ItemGroup>
<None Include="@(CefSharpWpfBinariesAnyCpu)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</When>
<When Condition="'$(Platform)' == 'x64'">
<ItemGroup>
<None Include="@(CefSharpWpfBinaries64)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</When>
<!-- x86, and Win32 -->
<Otherwise>
<ItemGroup>
<None Include="@(CefSharpWpfBinaries32)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Otherwise>
</Choose>
</Project>

0 comments on commit 6cb98ec

Please sign in to comment.