This repository has been archived on 2025-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
xerobrowser/packages/CefSharp.Common.87.1.132/buildTransitive/CefSharp.Common.targets
2023-02-20 23:24:10 +13:00

312 lines
No EOL
18 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="CefSharpTransformXmlDllPath">
<!-- MSBuild is finding the dll within the package and copying it which is a problem for AnyCPU -->
<Target Name="CefSharpDeleteCoreRuntimeAfterBuild" AfterTargets="AfterBuild" Condition="'$(PlatformTarget)' == 'AnyCPU' AND $(TargetFramework.StartsWith('net4'))">
<Delete Files="$(OutDir)CefSharp.Core.Runtime.dll" />
<Delete Files="$(OutDir)CefSharp.Core.Runtime.pdb" />
<Delete Files="$(OutDir)CefSharp.Core.Runtime.xml" />
</Target>
<!--
Add to project file for debuggint purposes
<Target Name="CefSharpAfterBuildDebug" AfterTargets="AfterBuild">
<CallTarget Targets="CefSharpAfterBuildDiagnostic"/>
</Target>
-->
<Target Name="CefSharpAfterBuildDiagnostic">
<Message Importance="high" Text="CefSharp After Build Diagnostic" />
<Message Importance="high" Text="CefSharpBuildAction = $(CefSharpBuildAction)" />
<Message Importance="high" Text="CefSharpTargetDir = $(CefSharpTargetDir)" />
<Message Importance="high" Text="CefSharpTargetDirAnyCpu32 = $(CefSharpTargetDirAnyCpu32)" />
<Message Importance="high" Text="CefSharpTargetDirAnyCpu64 = $(CefSharpTargetDirAnyCpu64)" />
<Message Importance="high" Text="RuntimeIdentifier = $(RuntimeIdentifier)" />
<Message Importance="high" Text="TargetFramework = $(PlatformTarget)" />
<Message Importance="high" Text="libcef.dll exists = $(OutDir)$(CefSharpTargetDir)libcef.dll" Condition="Exists('$(OutDir)$(CefSharpTargetDir)libcef.dll')" />
<Message Importance="high" Text="libcef.dll exists AnyCPU(x86) = $(OutDir)$(CefSharpTargetDirAnyCpu32)libcef.dll" Condition="Exists('$(OutDir)$(CefSharpTargetDirAnyCpu32)libcef.dll')" />
<Message Importance="high" Text="libcef.dll exists AnyCPU(x64) = $(OutDir)$(CefSharpTargetDirAnyCpu64)libcef.dll" Condition="Exists('$(OutDir)$(CefSharpTargetDirAnyCpu64)libcef.dll')" />
<Message Importance="high" Text="CefSharpTransformXmlDllPath = $(CefSharpTransformXmlDllPath)" />
<Message Importance="high" Text="NuGetProjectStyle = $(NuGetProjectStyle)" />
<Message Importance="high" Text="OutDir = $(OutDir)" />
</Target>
<PropertyGroup>
<!--
Used for AnyCPU transforming of app.config
If https://www.nuget.org/packages/MSBuild.Microsoft.VisualStudio.Web.targets/ package is installed
we'll attempt to use the task from there, otherwise see if it's installed as part of Visual Studio
If not installed then we'll fallback to the old behaviour (user has to manage AnyCPU themselves)
-->
<CefSharpTransformXmlDllPath Condition="$(VSToolsPath) == ''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll</CefSharpTransformXmlDllPath>
<CefSharpTransformXmlDllPath Condition="$(VSToolsPath) != ''" >$(VSToolsPath)\Web\Microsoft.Web.Publishing.Tasks.dll</CefSharpTransformXmlDllPath>
</PropertyGroup>
<PropertyGroup>
<!--
Allowable options are None, Content, NoAction.
None is the default (same as selecting the None Build Action in Visual Studio) for Non-SdkStyle (packages.config)
Content is the default (same as selecting the None Build Action in Visual Studio) for SdkStyle projects (PackageReference)
-->
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND '$(UsingMicrosoftNETSdk)' != 'true'">None</CefSharpBuildAction>
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND '$(UsingMicrosoftNETSdk)' == 'true'">Content</CefSharpBuildAction>
<CefSharpTargetDir Condition="'$(CefSharpTargetDir)' == ''"></CefSharpTargetDir>
<!-- Ideally we could use EnsureTrailingSlash, was only added on 2016 so unlikely supported in older version of VS -->
<CefSharpTargetDir Condition="'$(CefSharpTargetDir)' != '' AND !HasTrailingSlash('$(CefSharpTargetDir)')">$(CefSharpTargetDir)\</CefSharpTargetDir>
<CefSharpTargetDirAnyCpu32>$(CefSharpTargetDir)x86\</CefSharpTargetDirAnyCpu32>
<CefSharpTargetDirAnyCpu64>$(CefSharpTargetDir)x64\</CefSharpTargetDirAnyCpu64>
</PropertyGroup>
<Choose>
<!--
For .Net Core/Net5 when there's no runtime identifier specified then our lib files will be in the runtimes folders
we copy our unmanaged resources into the sub folder when required
-->
<When Condition="'$(RuntimeIdentifier)' == '' AND ($(TargetFramework.StartsWith('netcoreapp3')) OR $(TargetFramework.StartsWith('net5')))">
<Choose>
<When Condition="'$(PlatformTarget)' == 'x64'">
<PropertyGroup>
<CefSharpTargetDir>runtimes\win-x64\lib\netcoreapp3.0\</CefSharpTargetDir>
</PropertyGroup>
</When>
<When Condition="'$(PlatformTarget)' == 'x86'">
<PropertyGroup>
<CefSharpTargetDir>runtimes\win-x86\lib\netcoreapp3.0\</CefSharpTargetDir>
</PropertyGroup>
</When>
<When Condition="'$(PlatformTarget)' == 'AnyCPU'">
<PropertyGroup>
<CefSharpTargetDirAnyCpu32>runtimes\win-x86\lib\netcoreapp3.0\</CefSharpTargetDirAnyCpu32>
<CefSharpTargetDirAnyCpu64>runtimes\win-x64\lib\netcoreapp3.0\</CefSharpTargetDirAnyCpu64>
</PropertyGroup>
</When>
</Choose>
</When>
<!--
When CefSharpTargetDir is specified for x86/x64 platforms the files are included in a sub directory,
The CefSharp.dll file required by the BrowserSubProcess isn't copied by default and won't start, so we include an extra
copy.
-->
<When Condition="'$(CefSharpTargetDir)' != '' AND $(TargetFramework.StartsWith('net4')) AND '$(PlatformTarget)' != 'AnyCPU'">
<Choose>
<When Condition="'$(CefSharpBuildAction)' == 'None'">
<ItemGroup>
<None Include="@(CefSharpCommonManagedDlls)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
<When Condition="'$(CefSharpBuildAction)' == 'Content'">
<ItemGroup>
<Content Include="@(CefSharpCommonManagedDlls)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
</ItemGroup>
</When>
</Choose>
</When>
</Choose>
<Choose>
<When Condition="'$(CefSharpBuildAction)' == 'None'">
<Choose>
<When Condition="'$(PlatformTarget)' == 'x64'">
<ItemGroup>
<None Include="@(CefRedist64)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries64)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
<When Condition="'$(PlatformTarget)' == 'AnyCPU'">
<ItemGroup>
<None Include="@(CefRedist32)">
<Link>$(CefSharpTargetDirAnyCpu32)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefRedist64)">
<Link>$(CefSharpTargetDirAnyCpu64)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries32)">
<Link>$(CefSharpTargetDirAnyCpu32)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries64)">
<Link>$(CefSharpTargetDirAnyCpu64)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
<!--
Include CefSharp.dll and CefSharp.Core.dll (we only need CefSharp.dll but it's easier to include both)
in the arch specific folders as required by the BrowserSubProcess.
-->
<None Include="@(CefSharpCommonManagedDlls)">
<Link>$(CefSharpTargetDirAnyCpu32)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonManagedDlls)">
<Link>$(CefSharpTargetDirAnyCpu64)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</When>
<!-- x86 and Win32-->
<Otherwise>
<ItemGroup>
<None Include="@(CefRedist32)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries32)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
</Otherwise>
</Choose>
</When>
<When Condition="'$(CefSharpBuildAction)' == 'Content'">
<Choose>
<When Condition="'$(PlatformTarget)' == 'x64'">
<ItemGroup>
<Content Include="@(CefRedist64)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpCommonBinaries64)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
</ItemGroup>
</When>
<When Condition="'$(PlatformTarget)' == 'AnyCPU'">
<ItemGroup>
<Content Include="@(CefRedist32)">
<Link>$(CefSharpTargetDirAnyCpu32)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefRedist64)">
<Link>$(CefSharpTargetDirAnyCpu64)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpCommonBinaries32)">
<Link>$(CefSharpTargetDirAnyCpu32)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpCommonBinaries64)">
<Link>$(CefSharpTargetDirAnyCpu64)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
<!--
Include CefSharp.dll and CefSharp.Core.dll (we only need CefSharp.dll but it's easier to include both)
in the arch specific folders as required by the BrowserSubProcess.
-->
<Content Include="@(CefSharpCommonManagedDlls)">
<Link>$(CefSharpTargetDirAnyCpu32)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpCommonManagedDlls)">
<Link>$(CefSharpTargetDirAnyCpu64)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
</ItemGroup>
</When>
<!-- x86 and Win32-->
<Otherwise>
<ItemGroup>
<Content Include="@(CefRedist32)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpCommonBinaries32)">
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Included</PublishState>
<Visible>false</Visible>
</Content>
</ItemGroup>
</Otherwise>
</Choose>
</When>
</Choose>
<!--
For AnyCPU we use a Transform to add entries to app.config if possible
Otherwise throw error to alert user they need to perform additional action
-->
<UsingTask TaskName="TransformXml" AssemblyFile="$(CefSharpTransformXmlDllPath)" Condition="Exists('$(CefSharpTransformXmlDllPath)') AND '$(PlatformTarget)' == 'AnyCPU' AND '$(CefSharpAnyCpuSupport)' == ''" />
<Target Name="CefSharpCommonAnyCPUConfigTransform" AfterTargets="_CopyAppConfigFile" Condition="Exists('$(CefSharpTransformXmlDllPath)') AND '$(PlatformTarget)' == 'AnyCPU' AND '$(CefSharpAnyCpuSupport)' == ''">
<TransformXml Source="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')" Transform="$(MSBuildThisFileDirectory)..\build\app.config.x86.transform" Destination="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')"/>
<TransformXml Source="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')" Transform="$(MSBuildThisFileDirectory)..\build\app.config.x64.transform" Destination="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')"/>
</Target>
<Target Name="CefSharpPlatformCheck" BeforeTargets="ResolveAssemblyReferences" Condition="!Exists('$(CefSharpTransformXmlDllPath)') AND '$(PlatformTarget)' == 'AnyCPU' AND '$(CefSharpAnyCpuSupport)' != 'true'">
<Error Text="$(MSBuildThisFileName) is unable to proceeed as your current PlatformTarget is '$(PlatformTarget)'. To target AnyCPU please read https://github.com/cefsharp/CefSharp/issues/1714. Alternatively change your PlatformTarget to x86 or x64 and the relevant files will be copied automatically." HelpKeyword="CefSharpSolutionPlatformCheck" />
</Target>
<!--
Issue https://github.com/dotnet/project-system/issues/4158
The None/Content entries aren't picked up as the .targets file doesn't exist before the Nuget restore (only when using packages.config)
So in that scenario we display a mssage to the user. Close/reopen the project and the None/Content entries will work as above.
I have attempted to copy the files via a Copy Task, unfortunately the .props entries aren't accessible either so that's not feasible.
-->
<Target Name="CefSharpCopyFilesAfterNugetRestore32" AfterTargets="Build" Condition="'$(UsingMicrosoftNETSdk)' != 'true' AND !Exists('$(OutDir)$(CefSharpTargetDir)libcef.dll') AND '$(CefSharpBuildAction)' != 'NoAction' AND '$(PlatformTarget)' == 'x86'">
<Message Importance="high" Text="CefSharp - Files were not copied by MSBuild after Nuget install/restore! Please close and re-open $(MSBuildProjectFile)." />
</Target>
<Target Name="CefSharpCopyFilesAfterNugetRestore64" AfterTargets="Build" Condition="'$(UsingMicrosoftNETSdk)' != 'true' AND !Exists('$(OutDir)$(CefSharpTargetDir)libcef.dll') AND '$(CefSharpBuildAction)' != 'NoAction' AND '$(PlatformTarget)' == 'x64'">
<Message Importance="high" Text="CefSharp - Files were not copied by MSBuild after Nuget install/restore! Please close and re-open $(MSBuildProjectFile)." />
</Target>
<Target Name="CefSharpCopyFilesAfterNugetRestoreAnyCPU" AfterTargets="Build" Condition="'$(UsingMicrosoftNETSdk)' != 'true' AND !Exists('$(OutDir)$(CefSharpTargetDirAnyCpu32)libcef.dll') AND '$(CefSharpBuildAction)' != 'NoAction' AND '$(PlatformTarget)' == 'AnyCPU'">
<Message Importance="high" Text="CefSharp - Files were not copied by MSBuild after Nuget install/restore! Please close and re-open $(MSBuildProjectFile)." />
</Target>
</Project>