Skip to content

Commit 2ccb953

Browse files
committed
Nuget - When CefSharpTargetDir set copy CefSharp.dll to subfolder
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
1 parent dd17a9d commit 2ccb953

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

NuGet/CefSharp.Common.targets

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<Error Text="CefSharp requires .Net 4.5.2 or higher" />
55
</Target>
66

7+
<!-- MSBuild is finding the dll within the package and copying it which is a problem for AnyCPU -->
78
<Target Name="CefSharpDeleteCoreRuntimeAfterBuild" AfterTargets="AfterBuild" Condition="'$(PlatformTarget)' == 'AnyCPU' AND $(TargetFramework.StartsWith('net4'))">
89
<Delete Files="$(OutDir)CefSharp.Core.Runtime.dll" />
910
<Delete Files="$(OutDir)CefSharp.Core.Runtime.pdb" />
@@ -65,9 +66,41 @@
6566
</When>
6667
</Choose>
6768
</When>
68-
<Otherwise>
69-
70-
</Otherwise>
69+
<!--
70+
When CefSharpTargetDir is specified for x86/x64 platforms the files are included in a sub directory,
71+
The CefSharp.dll file required by the BrowserSubProcess isn't copied by default and won't start, so we include an extra
72+
copy.
73+
-->
74+
<When Condition="'$(CefSharpTargetDir)' != '' AND $(TargetFramework.StartsWith('net4')) AND '$(PlatformTarget)' != 'AnyCPU'">
75+
<Choose>
76+
<When Condition="'$(CefSharpBuildAction)' == 'None'">
77+
<ItemGroup>
78+
<None Include="@(CefSharpCommonManagedDlls)">
79+
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
80+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
81+
<PublishState>Included</PublishState>
82+
<Visible>false</Visible>
83+
</None>
84+
</ItemGroup>
85+
<PropertyGroup>
86+
<CefSharpResourceFilesCopied>true</CefSharpResourceFilesCopied>
87+
</PropertyGroup>
88+
</When>
89+
<When Condition="'$(CefSharpBuildAction)' == 'Content'">
90+
<ItemGroup>
91+
<Content Include="@(CefSharpCommonManagedDlls)">
92+
<Link>$(CefSharpTargetDir)%(RecursiveDir)%(FileName)%(Extension)</Link>
93+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
94+
<PublishState>Included</PublishState>
95+
<Visible>false</Visible>
96+
</Content>
97+
</ItemGroup>
98+
<PropertyGroup>
99+
<CefSharpResourceFilesCopied>true</CefSharpResourceFilesCopied>
100+
</PropertyGroup>
101+
</When>
102+
</Choose>
103+
</When>
71104
</Choose>
72105

73106
<Choose>

0 commit comments

Comments
 (0)