Skip to content

Commit 4642325

Browse files
committed
Net Core/Net 5 - Improve CefSharp.Common.NETCore.targets RID handling
Resolves #3773
1 parent 9567d14 commit 4642325

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

NuGet/PackageReference/CefSharp.Common.NETCore.targets

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<!-- Current supported values are Default, and NoAction (this target doesn't copy any files.) -->
4+
<!-- Map RuntimeIdentifier e.g. converts from win10-x64 to win-x64 -->
5+
<CefSharpRuntimeIdentifier>$(RuntimeIdentifier)</CefSharpRuntimeIdentifier>
6+
<CefSharpRuntimeIdentifier Condition="$(RuntimeIdentifier.StartsWith('win')) and $(RuntimeIdentifier.Contains('-x86'))">win-x86</CefSharpRuntimeIdentifier>
7+
<CefSharpRuntimeIdentifier Condition="$(RuntimeIdentifier.StartsWith('win')) and $(RuntimeIdentifier.Contains('-x64'))">win-x64</CefSharpRuntimeIdentifier>
8+
<CefSharpRuntimeIdentifier Condition="$(RuntimeIdentifier.StartsWith('win')) and $(RuntimeIdentifier.Contains('-arm64'))">win-arm64</CefSharpRuntimeIdentifier>
9+
<CefSharpRuntimeIdentifier Condition="'$(CefSharpRuntimeIdentifierOverride)' != ''">$(CefSharpRuntimeIdentifierOverride)</CefSharpRuntimeIdentifier>
10+
11+
<!-- Current supported values are Default, and NoAction (this target doesn't copy any files.) -->
512
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == ''">Default</CefSharpBuildAction>
613
<!--
714
For Library projects with no RuntimeIdentifier we don't include our additional files and packages, the transitive reference should flow directly to the consuming projects.
815
For class libraries that are often AnyCPU and consuming Exe/WinExe projects that are often win-x64 or win-x86 the resuiling build output
916
is polluted with extra copies in sub folders.
1017
-->
11-
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND '$(OutputType)' == 'Library' AND '$(RuntimeIdentifier)' == ''">NoAction</CefSharpBuildAction>
18+
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND '$(OutputType)' == 'Library' AND '$(CefSharpRuntimeIdentifier)' == ''">NoAction</CefSharpBuildAction>
1219
</PropertyGroup>
1320
<ItemGroup>
14-
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(RuntimeIdentifier)\native\CefSharp.BrowserSubprocess.runtimeconfig.json'))"/>
15-
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(RuntimeIdentifier)\native\CefSharp.BrowserSubprocess.exe'))" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '5.0' AND '$(PublishSingleFile)' == 'true' AND '$(SelfContained)' == 'true'"/>
16-
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(RuntimeIdentifier)\native\CefSharp.BrowserSubprocess.dll'))" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '5.0' AND '$(PublishSingleFile)' == 'true' AND '$(SelfContained)' == 'true'"/>
21+
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(CefSharpRuntimeIdentifier)\native\CefSharp.BrowserSubprocess.runtimeconfig.json'))"/>
22+
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(CefSharpRuntimeIdentifier)\native\CefSharp.BrowserSubprocess.exe'))" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '5.0' AND '$(PublishSingleFile)' == 'true' AND '$(SelfContained)' == 'true'"/>
23+
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(CefSharpRuntimeIdentifier)\native\CefSharp.BrowserSubprocess.dll'))" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '5.0' AND '$(PublishSingleFile)' == 'true' AND '$(SelfContained)' == 'true'"/>
1724
</ItemGroup>
1825

1926
<!--
2027
For SelfContained and PublishSingleFile we remove the CefSharp.BrowserSubprocess.runtimeconfig.json file so
2128
the BrowserSubprocess runs using the packaged .net runtime
2229
Issue https://github.com/cefsharp/CefSharp/issues/3407
2330
-->
24-
<Target Name="CefSharpExcludeBrowserSubprocessRuntimeConfigAfterResolveAssemblyReferences" AfterTargets="ResolveAssemblyReferences" Condition="'$(RuntimeIdentifier)' != '' AND '$(SelfContained)' == 'true'">
31+
<Target Name="CefSharpExcludeBrowserSubprocessRuntimeConfigAfterResolveAssemblyReferences" AfterTargets="ResolveAssemblyReferences" Condition="'$(CefSharpRuntimeIdentifier)' != '' AND '$(SelfContained)' == 'true'">
2532
<ItemGroup>
2633
<ReferenceCopyLocalPaths Remove="@(_CefSharpBrowserSubProcessFiles)" />
2734
</ItemGroup>
2835
</Target>
2936

30-
<Target Name="CefSharpExcludeBrowserSubprocessRuntimeConfigAfterComputeFilesToPublish" AfterTargets="ComputeFilesToPublish" Condition="'$(RuntimeIdentifier)' != '' AND '$(SelfContained)' == 'true'">
37+
<Target Name="CefSharpExcludeBrowserSubprocessRuntimeConfigAfterComputeFilesToPublish" AfterTargets="ComputeFilesToPublish" Condition="'$(CefSharpRuntimeIdentifier)' != '' AND '$(SelfContained)' == 'true'">
3138
<ItemGroup>
3239
<ResolvedFileToPublish Remove="@(_CefSharpBrowserSubProcessFiles)" />
3340
</ItemGroup>
@@ -38,7 +45,7 @@
3845
SelfHosting of the BrowserSubprocess is required
3946
Issue https://github.com/cefsharp/CefSharp/issues/3407
4047
-->
41-
<Target Name="CefSharpExcludeBrowserSubprocessRuntimeConfigBeforeComputeFilesToBundle" BeforeTargets="_ComputeFilesToBundle" Condition="'$(RuntimeIdentifier)' != '' AND '$(SelfContained)' == 'true'">
48+
<Target Name="CefSharpExcludeBrowserSubprocessRuntimeConfigBeforeComputeFilesToBundle" BeforeTargets="_ComputeFilesToBundle" Condition="'$(CefSharpRuntimeIdentifier)' != '' AND '$(SelfContained)' == 'true'">
4249
<ItemGroup>
4350
<ResolvedFileToPublish Remove="@(_CefSharpBrowserSubProcessFiles)" />
4451
</ItemGroup>
@@ -47,7 +54,7 @@
4754
<!--
4855
Remove from $(project).deps.json (sometimes the main deps file is reused)
4956
-->
50-
<Target Name="CefSharpExcludeBrowserSubprocessRuntimeConfigBeforeGenerateDependencyFile" BeforeTargets="GenerateBuildDependencyFile;GeneratePublishDependencyFile" Condition="'$(RuntimeIdentifier)' != '' AND '$(SelfContained)' == 'true'">
57+
<Target Name="CefSharpExcludeBrowserSubprocessRuntimeConfigBeforeGenerateDependencyFile" BeforeTargets="GenerateBuildDependencyFile;GeneratePublishDependencyFile" Condition="'$(CefSharpRuntimeIdentifier)' != '' AND '$(SelfContained)' == 'true'">
5158
<ItemGroup>
5259
<NativeCopyLocalItems Remove="@(_CefSharpBrowserSubProcessFiles)" />
5360
</ItemGroup>
@@ -63,6 +70,7 @@
6370
<Message Importance="high" Text="CefSharp After Build Diagnostic" />
6471
<Message Importance="high" Text="CefSharpBuildAction = $(CefSharpBuildAction)" />
6572
<Message Importance="high" Text="RuntimeIdentifier = $(RuntimeIdentifier)" />
73+
<Message Importance="high" Text="CefSharpRuntimeIdentifier = $(CefSharpRuntimeIdentifier)" />
6674
<Message Importance="high" Text="Platform = $(Platform)" />
6775
<Message Importance="high" Text="PlatformName = $(PlatformName)" />
6876
<Message Importance="high" Text="Platforms = $(Platforms)" />
@@ -83,7 +91,7 @@
8391
<When Condition="'$(CefSharpBuildAction)' == 'NoAction'">
8492
<!-- Do nothing -->
8593
</When>
86-
<When Condition="$(RuntimeIdentifier.StartsWith('win')) and $(RuntimeIdentifier.Contains('-x64'))">
94+
<When Condition="'$(CefSharpRuntimeIdentifier)' == 'win-x64'">
8795
<ItemGroup>
8896
<Content Include="@(CefRuntimeWin64Locales)">
8997
<Link>locales\%(RecursiveDir)%(FileName)%(Extension)</Link>
@@ -101,7 +109,7 @@
101109
</Content>
102110
</ItemGroup>
103111
</When>
104-
<When Condition="$(RuntimeIdentifier.StartsWith('win')) and $(RuntimeIdentifier.Contains('-x86'))">
112+
<When Condition="'$(CefSharpRuntimeIdentifier)' == 'win-x86'">
105113
<ItemGroup>
106114
<Content Include="@(CefRuntimeWin32Locales)">
107115
<Link>locales\%(RecursiveDir)%(FileName)%(Extension)</Link>
@@ -119,7 +127,7 @@
119127
</Content>
120128
</ItemGroup>
121129
</When>
122-
<When Condition="$(RuntimeIdentifier.StartsWith('win')) and $(RuntimeIdentifier.Contains('-arm64'))">
130+
<When Condition="'$(CefSharpRuntimeIdentifier)' == 'win-arm64'">
123131
<ItemGroup>
124132
<Content Include="@(CefRuntimeWinArm64Locales)">
125133
<Link>locales\%(RecursiveDir)%(FileName)%(Extension)</Link>

0 commit comments

Comments
 (0)