Skip to content

Commit 2b2031e

Browse files
committed
Nuget - When CefSharpTargetDir set remove the duplicate CefSharp.Core.Runtime.dll file from the bin folder
- Extra copy of CefSharp.Core.Runtime.dll when setting CefSharpTargetDir (see #3371 (reply in thread)) - Fix formatting (tabs to spaces, should change this to tabs at some point)
1 parent f63886f commit 2b2031e

File tree

2 files changed

+35
-34
lines changed

2 files changed

+35
-34
lines changed

NuGet/CefSharp.Common.targets

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="CefSharpTransformXmlDllPath">
33
<!--
44
MSBuild is finding CefSharp.Core.Runtime.dll from the x86 folder and copying it to the bin folder which is a problem for AnyCPU
5+
and when CefSharpTargetDir is used to move the files into a sub folder.
56
We manually remove CefSharp.Core.Runtime.dll from ReferenceCopyLocalPaths
67
https://thomasfreudenberg.com/archive/2012/11/21/dont-copy-my-referenced-assemblies/
78
-->
8-
<Target Name="CefSharpExcludeCoreRuntimeAfterResolveAssemblyReferences" AfterTargets="ResolveAssemblyReferences" Condition="'$(CefSharpPlatformTarget)' == 'AnyCPU' AND $(TargetFrameworkVersion.StartsWith('v4.'))">
9+
<Target Name="CefSharpExcludeCoreRuntimeAfterResolveAssemblyReferences" AfterTargets="ResolveAssemblyReferences" Condition="('$(CefSharpPlatformTarget)' == 'AnyCPU' OR '$(CefSharpTargetDir)' != '') AND $(TargetFrameworkVersion.StartsWith('v4.'))">
910
<ItemGroup>
10-
<ReferenceCopyLocalPaths Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.dll" />
11-
<ReferenceCopyLocalPaths Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.pdb" />
12-
<ReferenceCopyLocalPaths Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.xml" />
11+
<ReferenceCopyLocalPaths Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.dll" />
12+
<ReferenceCopyLocalPaths Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.pdb" />
13+
<ReferenceCopyLocalPaths Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.xml" />
1314
</ItemGroup>
1415
</Target>
1516

1617
<!--
17-
For VS2017 when publishing x86/x64 there's CefSharp.Core.Runtime.dll references in both _DeploymentManifestDependencies and _DeploymentManifestFiles
18-
This causes an Error occurred writing to hard disk exception, so we remove one (we leve the dependency and just remove the file reference.
18+
For VS2017 when publishing x86/x64 there's CefSharp.Core.Runtime.dll references in both _DeploymentManifestDependencies and _DeploymentManifestFiles
19+
This causes an Error occurred writing to hard disk exception, so we remove one (we leave the dependency and just remove the file reference).
1920
-->
2021
<Target Name="CefSharpExcludeCoreRuntimeBeforeGenerateApplicationManifest" BeforeTargets="GenerateApplicationManifest" Condition="'$(CefSharpPlatformTarget)' != 'AnyCPU' AND $(TargetFrameworkVersion.StartsWith('v4.'))">
2122
<ItemGroup>
22-
<_DeploymentManifestFiles Remove="$(MSBuildThisFileDirectory)..\CefSharp\$(PlatformTarget)\CefSharp.Core.Runtime.dll" />
23-
<_DeploymentManifestFiles Remove="$(MSBuildThisFileDirectory)..\CefSharp\$(PlatformTarget)\CefSharp.Core.Runtime.pdb" />
24-
<_DeploymentManifestFiles Remove="$(MSBuildThisFileDirectory)..\CefSharp\$(PlatformTarget)\CefSharp.Core.Runtime.xml" />
23+
<_DeploymentManifestFiles Remove="$(MSBuildThisFileDirectory)..\CefSharp\$(PlatformTarget)\CefSharp.Core.Runtime.dll" />
24+
<_DeploymentManifestFiles Remove="$(MSBuildThisFileDirectory)..\CefSharp\$(PlatformTarget)\CefSharp.Core.Runtime.pdb" />
25+
<_DeploymentManifestFiles Remove="$(MSBuildThisFileDirectory)..\CefSharp\$(PlatformTarget)\CefSharp.Core.Runtime.xml" />
2526
</ItemGroup>
2627
</Target>
2728

@@ -32,8 +33,8 @@
3233
<Target Name="CefSharpAnyCPUExcludeCoreRuntimeBeforeGenerateApplicationManifest" BeforeTargets="GenerateApplicationManifest" Condition="'$(CefSharpPlatformTarget)' == 'AnyCPU' AND $(TargetFrameworkVersion.StartsWith('v4.'))">
3334
<ItemGroup>
3435
<_DeploymentManifestDependencies Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.dll" />
35-
<_DeploymentManifestDependencies Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.pdb" />
36-
<_DeploymentManifestDependencies Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.xml" />
36+
<_DeploymentManifestDependencies Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.pdb" />
37+
<_DeploymentManifestDependencies Remove="$(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.Runtime.xml" />
3738
</ItemGroup>
3839
</Target>
3940

@@ -52,13 +53,13 @@
5253
<Message Importance="high" Text="CefSharpTargetDirAnyCpu64 = $(CefSharpTargetDirAnyCpu64)" />
5354
<Message Importance="high" Text="RuntimeIdentifier = $(RuntimeIdentifier)" />
5455
<Message Importance="high" Text="Platform = $(Platform)" />
55-
<Message Importance="high" Text="PlatformName = $(PlatformName)" />
56-
<Message Importance="high" Text="Platforms = $(Platforms)" />
57-
<Message Importance="high" Text="PlatformTarget = $(PlatformTarget)" />
58-
<Message Importance="high" Text="CefSharpPlatformTarget = $(CefSharpPlatformTarget)" />
59-
<Message Importance="high" Text="PlatformTargetAsMSBuildArchitecture = $(PlatformTargetAsMSBuildArchitecture)" />
60-
<Message Importance="high" Text="TargetFramework = $(TargetFramework)" />
61-
<Message Importance="high" Text="TargetFrameworkVersion = $(TargetFrameworkVersion)" />
56+
<Message Importance="high" Text="PlatformName = $(PlatformName)" />
57+
<Message Importance="high" Text="Platforms = $(Platforms)" />
58+
<Message Importance="high" Text="PlatformTarget = $(PlatformTarget)" />
59+
<Message Importance="high" Text="CefSharpPlatformTarget = $(CefSharpPlatformTarget)" />
60+
<Message Importance="high" Text="PlatformTargetAsMSBuildArchitecture = $(PlatformTargetAsMSBuildArchitecture)" />
61+
<Message Importance="high" Text="TargetFramework = $(TargetFramework)" />
62+
<Message Importance="high" Text="TargetFrameworkVersion = $(TargetFrameworkVersion)" />
6263
<Message Importance="high" Text="libcef.dll exists = $(OutDir)$(CefSharpTargetDir)libcef.dll" Condition="Exists('$(OutDir)$(CefSharpTargetDir)libcef.dll')" />
6364
<Message Importance="high" Text="libcef.dll exists AnyCPU(x86) = $(OutDir)$(CefSharpTargetDirAnyCpu32)libcef.dll" Condition="Exists('$(OutDir)$(CefSharpTargetDirAnyCpu32)libcef.dll')" />
6465
<Message Importance="high" Text="libcef.dll exists AnyCPU(x64) = $(OutDir)$(CefSharpTargetDirAnyCpu64)libcef.dll" Condition="Exists('$(OutDir)$(CefSharpTargetDirAnyCpu64)libcef.dll')" />
@@ -83,8 +84,8 @@
8384
Allowable options are None, Content, NoAction.
8485
None is the default (same as selecting the None Build Action in Visual Studio) for Nuget packages.config
8586
Content is the default (same as selecting the None Build Action in Visual Studio) for Nuget PackageReference
86-
Technically the older Non-SDK Style project can use PackageReference under VS2019 (possibly VS2017 as well),
87-
so we use NuGetProjectStyle which is defined in the .nuget.g.props file for projects using PackageReference
87+
Technically the older Non-SDK Style project can use PackageReference under VS2019 (possibly VS2017 as well),
88+
so we use NuGetProjectStyle which is defined in the .nuget.g.props file for projects using PackageReference
8889
-->
8990
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND '$(NuGetProjectStyle)' != 'PackageReference'">None</CefSharpBuildAction>
9091
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND '$(NuGetProjectStyle)' == 'PackageReference'">Content</CefSharpBuildAction>
@@ -93,16 +94,16 @@
9394
<CefSharpTargetDir Condition="'$(CefSharpTargetDir)' != '' AND !HasTrailingSlash('$(CefSharpTargetDir)')">$(CefSharpTargetDir)\</CefSharpTargetDir>
9495
<CefSharpTargetDirAnyCpu32>$(CefSharpTargetDir)x86\</CefSharpTargetDirAnyCpu32>
9596
<CefSharpTargetDirAnyCpu64>$(CefSharpTargetDir)x64\</CefSharpTargetDirAnyCpu64>
96-
<!--
97-
For Sdk Projects the PlatformTarget is unreliable (https://github.com/dotnet/sdk/issues/1560)
98-
It can incorrectly be AnyCPU when it is infact an arch specific build
99-
When AnyCPU and Prefer32Bit we just set the PlatformTarget to x86 (only when CefSharpAnyCpuSupport is empty)
100-
-->
101-
<CefSharpPlatformTarget>$(PlatformTarget)</CefSharpPlatformTarget>
102-
<CefSharpPlatformTarget Condition="'$(PlatformTargetAsMSBuildArchitecture)' == 'x86' OR '$(PlatformTargetAsMSBuildArchitecture)' == 'x64'">$(PlatformTargetAsMSBuildArchitecture)</CefSharpPlatformTarget>
103-
<CefSharpPlatformTarget Condition="'$(CefSharpPlatformTarget)' == 'AnyCPU' AND '$(Prefer32Bit)' == 'true' AND '$(CefSharpAnyCpuSupport)' == ''">x86</CefSharpPlatformTarget>
104-
<CefSharpPlatformTarget Condition="'$(CefSharpPlatformTargetOverride)' != ''">$(CefSharpPlatformTargetOverride)</CefSharpPlatformTarget>
105-
97+
<!--
98+
For Sdk Projects the PlatformTarget is unreliable (https://github.com/dotnet/sdk/issues/1560)
99+
It can incorrectly be AnyCPU when it is infact an arch specific build
100+
When AnyCPU and Prefer32Bit we just set the PlatformTarget to x86 (only when CefSharpAnyCpuSupport is empty)
101+
-->
102+
<CefSharpPlatformTarget>$(PlatformTarget)</CefSharpPlatformTarget>
103+
<CefSharpPlatformTarget Condition="'$(PlatformTargetAsMSBuildArchitecture)' == 'x86' OR '$(PlatformTargetAsMSBuildArchitecture)' == 'x64'">$(PlatformTargetAsMSBuildArchitecture)</CefSharpPlatformTarget>
104+
<CefSharpPlatformTarget Condition="'$(CefSharpPlatformTarget)' == 'AnyCPU' AND '$(Prefer32Bit)' == 'true' AND '$(CefSharpAnyCpuSupport)' == ''">x86</CefSharpPlatformTarget>
105+
<CefSharpPlatformTarget Condition="'$(CefSharpPlatformTargetOverride)' != ''">$(CefSharpPlatformTargetOverride)</CefSharpPlatformTarget>
106+
106107
</PropertyGroup>
107108

108109
<Choose>

NuGet/PackageReference/CefSharp.Common.NETCore.targets

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup>
44
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(RuntimeIdentifier)\native\CefSharp.BrowserSubprocess.runtimeconfig.json'))"/>
5-
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(RuntimeIdentifier)\native\CefSharp.BrowserSubprocess.exe'))" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '5.0' AND '$(PublishSingleFile)' == 'true' AND '$(SelfContained)' == 'true'"/>
6-
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(RuntimeIdentifier)\native\CefSharp.BrowserSubprocess.dll'))" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '5.0' AND '$(PublishSingleFile)' == 'true' AND '$(SelfContained)' == 'true'"/>
5+
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(RuntimeIdentifier)\native\CefSharp.BrowserSubprocess.exe'))" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '5.0' AND '$(PublishSingleFile)' == 'true' AND '$(SelfContained)' == 'true'"/>
6+
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(RuntimeIdentifier)\native\CefSharp.BrowserSubprocess.dll'))" Condition="'$(_TargetFrameworkVersionWithoutV)' >= '5.0' AND '$(PublishSingleFile)' == 'true' AND '$(SelfContained)' == 'true'"/>
77
</ItemGroup>
88

99
<!--
@@ -63,8 +63,8 @@
6363
<Message Importance="high" Text="SelfContained = $(SelfContained)" />
6464
<Message Importance="high" Text="PublishSingleFile = $(PublishSingleFile)" />
6565
<Message Importance="high" Text="OutDir = $(OutDir)" />
66-
<Message Importance="high" Text="_CefSharpBrowserSubProcessFiles = @(_CefSharpBrowserSubProcessFiles)" />
67-
<Message Importance="high" Text="_TargetFrameworkVersionWithoutV = $(_TargetFrameworkVersionWithoutV)" />
66+
<Message Importance="high" Text="_CefSharpBrowserSubProcessFiles = @(_CefSharpBrowserSubProcessFiles)" />
67+
<Message Importance="high" Text="_TargetFrameworkVersionWithoutV = $(_TargetFrameworkVersionWithoutV)" />
6868
</Target>
6969

7070
<Choose>

0 commit comments

Comments
 (0)