Skip to content

Commit 8a6241c

Browse files
committed
Nuget - Change default CefSharpBuildAction for Exe/WinExe projects when using packages.config
- For Non library projects that use packages.config the default is now Content which should simplify clickonce support For libraries the default will remain as None - For NetCore projects CefSharpBuildAction Content is mapped to default to support upgrading users Technically this is a breaking change, user impact is expected to be low and can be overridden to restore the previous behaviour in the edge cases. Issue #4062
1 parent 212026e commit 8a6241c

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

NuGet/CefSharp.Common.targets

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,21 @@
9696
<PropertyGroup>
9797
<!--
9898
Allowable options are None, Content, NoAction.
99-
None is the default (same as selecting the None Build Action in Visual Studio) for Nuget packages.config
100-
Content is the default (same as selecting the None Build Action in Visual Studio) for Nuget PackageReference
99+
100+
None is the default (same as selecting the None Build Action in Visual Studio) for Nuget packages.config
101+
for WinExe/Exe projects (anything that's not Library) see https://github.com/cefsharp/CefSharp/issues/4062
102+
None will copy the dependenceis to a directly referencing project file which is useful for library projects
103+
that target packages.config as buildTransitive is not supported.
104+
105+
Content is the default (same as selecting the Content Build Action in Visual Studio) for Nuget PackageReference
106+
and WinExe/Exe projects (anything that's not Library)
101107
Technically the older Non-SDK Style project can use PackageReference under VS2019 (possibly VS2017 as well),
102108
so we use NuGetProjectStyle which is defined in the .nuget.g.props file for projects using PackageReference.
103-
For Library projects with Nuget supports buildTransitive we don't include our additional files and packages, the transitive reference should flow directly to the consuming projects.
104109
For class libraries that are often AnyCPU and consuming Exe/WinExe projects that are x64 or x86 the resulting build output
105-
is polluted with extra copies in sub folders.
110+
is polluted with extra copies in sub folders. Set CefSharpBuildAction to NoAction to avoid copying the files.
106111
-->
107112
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND '$(NuGetProjectStyle)' != 'PackageReference'">None</CefSharpBuildAction>
108-
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND '$(NuGetProjectStyle)' == 'PackageReference'">Content</CefSharpBuildAction>
113+
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND ('$(NuGetProjectStyle)' == 'PackageReference' OR '$(OutputType)' != 'Library')">Content</CefSharpBuildAction>
109114

110115
<CefSharpTargetDir Condition="'$(CefSharpTargetDir)' == ''"></CefSharpTargetDir>
111116
<!-- Ideally we could use EnsureTrailingSlash, was only added on 2017 so unlikely supported in older version of VS -->

NuGet/PackageReference/CefSharp.Common.NETCore.targets

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
https://docs.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support#plugin-with-library-dependencies
1717
-->
1818
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == '' AND '$(OutputType)' == 'Library' AND '$(EnableDynamicLoading)' != 'true'">NoAction</CefSharpBuildAction>
19-
<!-- Current supported values are Default, and NoAction (this target doesn't copy any files.) -->
19+
<!--
20+
Current supported values are Default, Content, and NoAction (this target doesn't copy any files.)
21+
For backwards compatability for the older nuget packages Content will be mapped to Default
22+
-->
2023
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == ''">Default</CefSharpBuildAction>
24+
<CefSharpBuildAction Condition="'$(CefSharpBuildAction)' == 'Content'">Default</CefSharpBuildAction>
2125
</PropertyGroup>
2226
<ItemGroup>
2327
<_CefSharpBrowserSubProcessFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\runtimes\$(CefSharpRuntimeIdentifier)\native\CefSharp.BrowserSubprocess.runtimeconfig.json'))"/>

0 commit comments

Comments
 (0)