Skip to content

Commit a29a1df

Browse files
committed
Nuget - Copy files on Nuget install/restore
Adding a PropertyGroup to each Chose/When block appears to be enough to get the files copied successfully. Still needs more testing Issue #3319
1 parent 3bba422 commit a29a1df

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

NuGet/CefSharp.Common.app.config.x64.transform

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<!-- Add the codebase section if missing. -->
2121
<codeBase xdt:Transform="InsertIfMissing"/>
2222
<!-- Ensure the codeBase version and href are set to the correct values. -->
23-
<codeBase version="87.1.12.0" href="x64/CefSharp.Core.Runtime.dll" xdt:Transform="Replace"/>
23+
<codeBase version="87.1.13.0" href="x64/CefSharp.Core.Runtime.dll" xdt:Transform="Replace"/>
2424
</dependentAssembly>
2525
</assemblyBinding>
2626
</runtime>

NuGet/CefSharp.Common.app.config.x86.transform

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<!-- Add the codebase section if missing. -->
2121
<codeBase xdt:Transform="InsertIfMissing"/>
2222
<!-- Ensure the codeBase version and href are set to the correct values. -->
23-
<codeBase version="87.1.12.0" href="x86/CefSharp.Core.Runtime.dll" xdt:Transform="Replace"/>
23+
<codeBase version="87.1.13.0" href="x86/CefSharp.Core.Runtime.dll" xdt:Transform="Replace"/>
2424
</dependentAssembly>
2525
</assemblyBinding>
2626
</runtime>

NuGet/CefSharp.Common.targets

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<Delete Files="$(OutDir)CefSharp.Core.Runtime.xml" />
1111
</Target>
1212

13+
<!-- <Target Name="CefSharpAfterBuildDebug" AfterTargets="AfterBuild"> -->
14+
<!-- <Message Importance="high" Text="CefSharp - ResourceFilesCopied = $(CefSharpResourceFilesCopied)" /> -->
15+
<!-- </Target> -->
16+
1317
<PropertyGroup>
1418
<!--
1519
Used for AnyCPU transforming of app.config
@@ -80,6 +84,9 @@
8084
<Visible>false</Visible>
8185
</None>
8286
</ItemGroup>
87+
<PropertyGroup>
88+
<CefSharpResourceFilesCopied>true</CefSharpResourceFilesCopied>
89+
</PropertyGroup>
8390
</When>
8491
<When Condition="'$(PlatformTarget)' == 'AnyCPU'">
8592
<ItemGroup>
@@ -124,6 +131,9 @@
124131
<Visible>false</Visible>
125132
</None>
126133
</ItemGroup>
134+
<PropertyGroup>
135+
<CefSharpResourceFilesCopied>true</CefSharpResourceFilesCopied>
136+
</PropertyGroup>
127137
</When>
128138
<!-- x86 and Win32-->
129139
<Otherwise>
@@ -141,6 +151,9 @@
141151
<Visible>false</Visible>
142152
</None>
143153
</ItemGroup>
154+
<PropertyGroup>
155+
<CefSharpResourceFilesCopied>true</CefSharpResourceFilesCopied>
156+
</PropertyGroup>
144157
</Otherwise>
145158
</Choose>
146159
</When>
@@ -161,6 +174,9 @@
161174
<Visible>false</Visible>
162175
</Content>
163176
</ItemGroup>
177+
<PropertyGroup>
178+
<CefSharpResourceFilesCopied>true</CefSharpResourceFilesCopied>
179+
</PropertyGroup>
164180
</When>
165181
<When Condition="'$(PlatformTarget)' == 'AnyCPU'">
166182
<ItemGroup>
@@ -205,6 +221,9 @@
205221
<Visible>false</Visible>
206222
</Content>
207223
</ItemGroup>
224+
<PropertyGroup>
225+
<CefSharpResourceFilesCopied>true</CefSharpResourceFilesCopied>
226+
</PropertyGroup>
208227
</When>
209228
<!-- x86 and Win32-->
210229
<Otherwise>
@@ -222,6 +241,9 @@
222241
<Visible>false</Visible>
223242
</Content>
224243
</ItemGroup>
244+
<PropertyGroup>
245+
<CefSharpResourceFilesCopied>true</CefSharpResourceFilesCopied>
246+
</PropertyGroup>
225247
</Otherwise>
226248
</Choose>
227249
</When>
@@ -241,4 +263,35 @@
241263
<Target Name="CefSharpPlatformCheck" BeforeTargets="ResolveAssemblyReferences" Condition="!Exists('$(CefSharpTransformXmlDllPath)') AND '$(PlatformTarget)' == 'AnyCPU' AND '$(CefSharpAnyCpuSupport)' != 'true'">
242264
<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" />
243265
</Target>
266+
267+
<!--
268+
Issue https://github.com/dotnet/project-system/issues/4158
269+
The None/Content entries aren't picked up as the .targets file doesn't exist before the Nuget restore (only when using packages.config)
270+
So in that scenario we use a Target to copy the files. Close/reopen the project and the None/Content entries will work as above
271+
NOTE: Commented out for now that it's possible that including the PropertyGroup is enough to force the project to copy the files in VS2019 (not tested in any other VS version yet)
272+
Will add/remove this if required after further testing
273+
-->
274+
<!-- <Target Name="CefSharpCopyFilesAfterNugetRestore32" AfterTargets="AfterBuild" Condition="'$(UsingMicrosoftNETSdk)' != 'true' AND '$(CefSharpResourceFilesCopied)' != 'true' AND '$(CefSharpBuildAction)' != 'NoAction' AND '$(PlatformTarget)' == 'x86'"> -->
275+
<!-- <Message Importance="high" Text="CefSharp - Files were not copied by MSBuild after Nuget install/restore, copying (x64) $(OutDir)$(CefSharpTargetDir)" /> -->
276+
<!-- <Copy SourceFiles="@(CefRedist32)" DestinationFolder="$(OutDir)$(CefSharpTargetDir)" SkipUnchangedFiles="true" /> -->
277+
<!-- <Copy SourceFiles="@(CefSharpCommonBinaries32)" DestinationFolder="$(OutDir)$(CefSharpTargetDir)" SkipUnchangedFiles="true" /> -->
278+
<!-- </Target> -->
279+
280+
<!-- <Target Name="CefSharpCopyFilesAfterNugetRestore64" AfterTargets="AfterBuild" Condition="'$(UsingMicrosoftNETSdk)' != 'true' AND '$(CefSharpResourceFilesCopied)' != 'true' AND '$(CefSharpBuildAction)' != 'NoAction' AND '$(PlatformTarget)' == 'x64'"> -->
281+
<!-- <Message Importance="high" Text="CefSharp - Files were not copied by MSBuild after Nuget install/restore, copying (x64) $(OutDir)$(CefSharpTargetDir)" /> -->
282+
<!-- <Copy SourceFiles="@(CefRedist64)" DestinationFolder="$(OutDir)$(CefSharpTargetDir)" SkipUnchangedFiles="true" /> -->
283+
<!-- <Copy SourceFiles="@(CefSharpCommonBinaries64)" DestinationFolder="$(OutDir)$(CefSharpTargetDir)" SkipUnchangedFiles="true" /> -->
284+
<!-- </Target> -->
285+
286+
<!-- <Target Name="CefSharpCopyFilesAfterNugetRestoreAnyCPU" AfterTargets="AfterBuild" Condition="'$(UsingMicrosoftNETSdk)' != 'true' AND '$(CefSharpResourceFilesCopied)' != 'true' AND '$(CefSharpBuildAction)' != 'NoAction' AND '$(PlatformTarget)' == 'AnyCPU'"> -->
287+
<!-- <Message Importance="high" Text="CefSharp - Files were not copied by MSBuild after Nuget install/restore, copying (AnyCPU) $(OutDir)$(CefSharpTargetDir)" /> -->
288+
<!-- <Copy SourceFiles="@(CefRedist32)" DestinationFolder="$(OutDir)$(CefSharpTargetDirAnyCpu32)" SkipUnchangedFiles="true" /> -->
289+
<!-- <Copy SourceFiles="@(CefSharpCommonBinaries32)" DestinationFolder="$(OutDir)$(CefSharpTargetDirAnyCpu32)" SkipUnchangedFiles="true" /> -->
290+
291+
<!-- <Copy SourceFiles="@(CefRedist64)" DestinationFolder="$(OutDir)$(CefSharpTargetDirAnyCpu64)" SkipUnchangedFiles="true" /> -->
292+
<!-- <Copy SourceFiles="@(CefSharpCommonBinaries64)" DestinationFolder="$(OutDir)$(CefSharpTargetDirAnyCpu64)" SkipUnchangedFiles="true" /> -->
293+
294+
<!-- <Copy SourceFiles="@(CefSharpCommonManagedDlls)" DestinationFolder="$(OutDir)$(CefSharpTargetDirAnyCpu32)" SkipUnchangedFiles="true" /> -->
295+
<!-- <Copy SourceFiles="@(CefSharpCommonManagedDlls)" DestinationFolder="$(OutDir)$(CefSharpTargetDirAnyCpu64)" SkipUnchangedFiles="true" /> -->
296+
<!-- </Target> -->
244297
</Project>

0 commit comments

Comments
 (0)