Skip to content

Commit

Permalink
Use Choose instead of ItemGroup to conditionally include files.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ellingsworth authored and David Ellingsworth committed Jul 13, 2020
1 parent 582b342 commit 3c64bf6
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 77 deletions.
66 changes: 37 additions & 29 deletions NuGet/CefSharp.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,44 @@
correct ordering .props imports, which we require as this depends on the cef.redist packages
exporting an ItemGroup
-->
<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<None Include="@(CefRedist32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>

<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')">
<None Include="@(CefRedist64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
<Choose>
<When Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<ItemGroup>
<None Include="@(CefRedist32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
</Choose>

<Choose>
<When Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')">
<ItemGroup>
<None Include="@(CefRedist64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
</Choose>

<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="CefSharpCommon_TransformX86Config" Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')" AfterTargets="_CopyAppConfigFile">
<TransformXml Source="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')" Transform="$(MSBuildThisFileDirectory)app.config.x86.transform" Destination="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')"/>
Expand Down
40 changes: 24 additions & 16 deletions NuGet/CefSharp.OffScreen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,31 @@
-->

<!-- Copy platform specific libraries to the platform specific folders. -->
<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<None Include="@(CefSharpOffScreenBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
<Choose>
<When Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<ItemGroup>
<None Include="@(CefSharpOffScreenBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
</Choose>

<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')">
<None Include="@(CefSharpOffScreenBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
<Choose>
<When Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')">
<ItemGroup>
<None Include="@(CefSharpOffScreenBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
</Choose>

<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="CefSharpOffScreen_TransformX86Config" Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')" AfterTargets="_CopyAppConfigFile">
Expand Down
40 changes: 24 additions & 16 deletions NuGet/CefSharp.WinForms.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,31 @@
-->

<!-- Copy platform specific libraries to the platform specific folders. -->
<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<None Include="@(CefSharpWinFormsBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
<Choose>
<When Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<ItemGroup>
<None Include="@(CefSharpWinFormsBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
</Choose>

<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')">
<None Include="@(CefSharpWinFormsBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
<Choose>
<When Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')">
<ItemGroup>
<None Include="@(CefSharpWinFormsBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
</Choose>

<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="CefSharpWinForms_TransformX86Config" Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')" AfterTargets="_CopyAppConfigFile">
Expand Down
40 changes: 24 additions & 16 deletions NuGet/CefSharp.Wpf.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,31 @@
-->

<!-- Copy platform specific libraries to the platform specific folders. -->
<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<None Include="@(CefSharpWpfBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
<Choose>
<When Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<ItemGroup>
<None Include="@(CefSharpWpfBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
</Choose>

<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')">
<None Include="@(CefSharpWpfBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
<Choose>
<When Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')">
<ItemGroup>
<None Include="@(CefSharpWpfBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
</Choose>

<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="CefSharpWpf_TransformX86Config" Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')" AfterTargets="_CopyAppConfigFile">
Expand Down

0 comments on commit 3c64bf6

Please sign in to comment.