Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move platform dependent files to respective directories. #3168

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CefSharp3.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,26 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefSharp.WinForms.Example",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{A23AA466-1903-44F2-946D-25AD0500D56B}"
ProjectSection(SolutionItems) = preProject
NuGet\CefSharp.Common.app.config.x64.transform = NuGet\CefSharp.Common.app.config.x64.transform
NuGet\CefSharp.Common.app.config.x86.transform = NuGet\CefSharp.Common.app.config.x86.transform
NuGet\CefSharp.Common.nuspec = NuGet\CefSharp.Common.nuspec
NuGet\CefSharp.Common.props = NuGet\CefSharp.Common.props
NuGet\CefSharp.Common.targets = NuGet\CefSharp.Common.targets
NuGet\CefSharp.OffScreen.app.config.x64.transform = NuGet\CefSharp.OffScreen.app.config.x64.transform
NuGet\CefSharp.OffScreen.app.config.x86.transform = NuGet\CefSharp.OffScreen.app.config.x86.transform
NuGet\CefSharp.OffScreen.nuspec = NuGet\CefSharp.OffScreen.nuspec
NuGet\CefSharp.OffScreen.props = NuGet\CefSharp.OffScreen.props
NuGet\CefSharp.OffScreen.targets = NuGet\CefSharp.OffScreen.targets
NuGet\CefSharp.WinForms.app.config.x64.transform = NuGet\CefSharp.WinForms.app.config.x64.transform
NuGet\CefSharp.WinForms.app.config.x86.transform = NuGet\CefSharp.WinForms.app.config.x86.transform
NuGet\CefSharp.WinForms.nuspec = NuGet\CefSharp.WinForms.nuspec
NuGet\CefSharp.WinForms.props = NuGet\CefSharp.WinForms.props
NuGet\CefSharp.WinForms.targets = NuGet\CefSharp.WinForms.targets
NuGet\CefSharp.Wpf.app.config.x64.transform = NuGet\CefSharp.Wpf.app.config.x64.transform
NuGet\CefSharp.Wpf.app.config.x86.transform = NuGet\CefSharp.Wpf.app.config.x86.transform
NuGet\CefSharp.Wpf.nuspec = NuGet\CefSharp.Wpf.nuspec
NuGet\CefSharp.Wpf.props = NuGet\CefSharp.Wpf.props
NuGet\CefSharp.Wpf.targets = NuGet\CefSharp.Wpf.targets
NuGet\Readme.txt = NuGet\Readme.txt
EndProjectSection
EndProject
Expand Down
53 changes: 53 additions & 0 deletions NuGet/CefSharp.Common.app.config.x64.transform
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1">
<!-- Add the runtime section if missing. -->
<runtime xdt:Transform="InsertIfMissing"/>

<runtime>
<!-- Add the assemblyBinding section if missing. -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" xdt:Transform="InsertIfMissing"/>
</runtime>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- Add the dependentAssembly section for CefSharp.Core if missing. -->
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x64' and asmv1:assemblyIdentity/@name='CefSharp.Core')">
<assemblyIdentity name="CefSharp.Core" processorArchitecture="x64" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
</dependentAssembly>

<!-- Add or update the codeBase information for CefSharp.Core. -->
<dependentAssembly xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x64' and asmv1:assemblyIdentity/@name='CefSharp.Core')">
<!-- Add the codebase section if missing. -->
<codeBase xdt:Transform="InsertIfMissing"/>
<!-- Ensure the codeBase version and href are set to the correct values. -->
<codeBase version="83.4.3.0" href="x64/CefSharp.Core.dll" xdt:Transform="Replace"/>
</dependentAssembly>

<!-- Add the dependentAssembly section for CefSharp if missing. -->
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x64' and asmv1:assemblyIdentity/@name='CefSharp')">
<assemblyIdentity name="CefSharp" processorArchitecture="x64" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
</dependentAssembly>

<!-- Add or update the codeBase information for CefSharp. -->
<dependentAssembly xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x64' and asmv1:assemblyIdentity/@name='CefSharp')">
<!-- Add the codeBase section if missing. -->
<codeBase xdt:Transform="InsertIfMissing"/>
<!-- Ensure the codeBase version and href are set to the correct values. -->
<codeBase xdt:Transform="Replace" version="83.4.3.0" href="x64/CefSharp.dll"/>
</dependentAssembly>

<!-- Add the dependentAssembly section for CefSharp.BrowserSubprocess.Core if missing. -->
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x64' and asmv1:assemblyIdentity/@name='CefSharp.BrowserSubprocess.Core')">
<assemblyIdentity name="CefSharp.BrowserSubprocess.Core" processorArchitecture="x64" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
</dependentAssembly>

<!-- Add or update the codeBase information for CefSharp.BrowserSubprocess.Core -->
<dependentAssembly xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x64' and asmv1:assemblyIdentity/@name='CefSharp.BrowserSubprocess.Core')">
<!-- Add the codeBase section if missing. -->
<codeBase xdt:Transform="InsertIfMissing"/>
<!-- Ensure the codeBase version and href are set to the correct values. -->
<codeBase xdt:Transform="Replace" version="83.4.3.0" href="x64/CefSharp.BrowserSubprocess.Core.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
53 changes: 53 additions & 0 deletions NuGet/CefSharp.Common.app.config.x86.transform
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1">
<!-- Add the runtime section if missing. -->
<runtime xdt:Transform="InsertIfMissing"/>

<runtime>
<!-- Add the assemblyBinding section if missing. -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" xdt:Transform="InsertIfMissing"/>
</runtime>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- Add the dependentAssembly section for CefSharp.Core if missing. -->
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x86' and asmv1:assemblyIdentity/@name='CefSharp.Core')">
<assemblyIdentity name="CefSharp.Core" processorArchitecture="x86" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
</dependentAssembly>

<!-- Add or update the codeBase information for CefSharp.Core. -->
<dependentAssembly xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x86' and asmv1:assemblyIdentity/@name='CefSharp.Core')">
<!-- Add the codebase section if missing. -->
<codeBase xdt:Transform="InsertIfMissing"/>
<!-- Ensure the codeBase version and href are set to the correct values. -->
<codeBase version="83.4.3.0" href="x86/CefSharp.Core.dll" xdt:Transform="Replace"/>
</dependentAssembly>

<!-- Add the dependentAssembly section for CefSharp if missing. -->
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x86' and asmv1:assemblyIdentity/@name='CefSharp')">
<assemblyIdentity name="CefSharp" processorArchitecture="x86" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
</dependentAssembly>

<!-- Add or update the codeBase information for CefSharp. -->
<dependentAssembly xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x86' and asmv1:assemblyIdentity/@name='CefSharp')">
<!-- Add the codeBase section if missing. -->
<codeBase xdt:Transform="InsertIfMissing"/>
<!-- Ensure the codeBase version and href are set to the correct values. -->
<codeBase xdt:Transform="Replace" version="83.4.3.0" href="x86/CefSharp.dll"/>
</dependentAssembly>

<!-- Add the dependentAssembly section for CefSharp.BrowserSubprocess.Core if missing. -->
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x86' and asmv1:assemblyIdentity/@name='CefSharp.BrowserSubprocess.Core')">
<assemblyIdentity name="CefSharp.BrowserSubprocess.Core" processorArchitecture="x86" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
</dependentAssembly>

<!-- Add or update the codeBase information for CefSharp.BrowserSubprocess.Core -->
<dependentAssembly xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x86' and asmv1:assemblyIdentity/@name='CefSharp.BrowserSubprocess.Core')">
<!-- Add the codeBase section if missing. -->
<codeBase xdt:Transform="InsertIfMissing"/>
<!-- Ensure the codeBase version and href are set to the correct values. -->
<codeBase xdt:Transform="Replace" version="83.4.3.0" href="x86/CefSharp.BrowserSubprocess.Core.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
2 changes: 2 additions & 0 deletions NuGet/CefSharp.Common.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

<file src="CefSharp.Common.props" target="build" />
<file src="CefSharp.Common.targets" target="build" />
<file src="CefSharp.Common.app.config.x86.transform" target="build\app.config.x86.transform" />
<file src="CefSharp.Common.app.config.x64.transform" target="build\app.config.x64.transform" />

<file src="..\CefSharp\**\*.cs" target="src\CefSharp" />
<file src="..\CefSharp.Core\**\*.h" target="src\CefSharp.Core" />
Expand Down
54 changes: 13 additions & 41 deletions NuGet/CefSharp.Common.targets
Original file line number Diff line number Diff line change
@@ -1,77 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="PlatformCheck" BeforeTargets="ResolveAssemblyReferences" Condition="(('$(Platform)' != 'x86') AND ('$(Platform)' != 'x64') AND ('$(Platform)' != 'Win32') AND '$(CefSharpAnyCpuSupport)' != 'true')">
<Error Text="$(MSBuildThisFileName) is unable to proceeed as your current Platform is '$(Platform)'. To target AnyCPU please read https://github.com/cefsharp/CefSharp/issues/1714. Alternatively change your Platform to x86 or x64 and the relevant files will be copied automatically. For details on changing your projects Platform see https://docs.microsoft.com/en-gb/visualstudio/ide/how-to-configure-projects-to-target-platforms?view=vs-2017" HelpKeyword="CefSharpSolutionPlatformCheck" />
</Target>

<Target Name="FrameworkVersionCheck" BeforeTargets="ResolveAssemblyReferences" Condition="(('$(TargetFrameworkVersion)' == 'v4.5.1') OR ('$(TargetFrameworkVersion)' == 'v4.5') OR ('$(TargetFrameworkVersion)' == 'v4.0'))">
<Error Text="CefSharp requires .Net 4.5.2 or higher" />
</Target>

<PropertyGroup>
<CefSharpTargetDir Condition=" '$(CefSharpTargetDir)' == '' ">.</CefSharpTargetDir>
</PropertyGroup>

<!--
These item groups should be in the .props file, unfortunately Nuget 2.8.x doesn't gurantee the
correct ordering .props imports, which we require as this depends on the cef.redist packages
exporting an ItemGroup
-->

<ItemGroup Condition="('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')">
<None Include="@(CefRedist32)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries32)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>

<ItemGroup Condition="'$(Platform)' == 'x64'">
<ItemGroup Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')">
<None Include="@(CefRedist64)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries64)">
<Link>$(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)</Link>
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>

<ItemGroup Condition="'$(Platform)' == 'AnyCPU'">
<None Include="@(CefRedist32)">
<Link>$(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefRedist64)">
<Link>$(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries32)">
<Link>$(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
<None Include="@(CefSharpCommonBinaries64)">
<Link>$(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</None>
</ItemGroup>
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this run on VS2013/VS2015? The folder structure changed starting with VS2017, so I'd be surprised if this actually ran on older versions.

From what I can tell Microsoft.Web.Publishing.Tasks.dll is not guaranteed to be installed in Visual Studio, looks like it's only installed as part of the web development tools. I don't think we can reasonably ask people to install this just to use our nuget package. Specially anyone upgrading for whom the packages worked previously.

Reference https://stackoverflow.com/a/44855452/4583726

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of this, I think we can resolve this by using a custom task library that utilizes Microsoft.Web.Xdt.

<Target Name="CefSharpCommon_TransformX86Config" Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x86') OR ('$(Platform)' == 'Win32')" AfterTargets="_CopyAppConfigFile">
<TransformXml Source="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')" Transform="$(MSBuildThisFileDirectory)app.config.x86.transform" Destination="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')"/>
</Target>
<Target Name="CefSharpCommon_TransformX64Config" Condition="('$(Platform)' == 'AnyCPU') OR ('$(Platform)' == 'x64')" AfterTargets="_CopyAppConfigFile">
<TransformXml Source="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')" Transform="$(MSBuildThisFileDirectory)app.config.x64.transform" Destination="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')"/>
</Target>
</Project>
27 changes: 27 additions & 0 deletions NuGet/CefSharp.OffScreen.app.config.x64.transform
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1">
<!-- Add the runtime section if missing. -->
<runtime xdt:Transform="InsertIfMissing"/>

<runtime>
<!-- Add the assemblyBinding section if missing. -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" xdt:Transform="InsertIfMissing"/>
</runtime>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- Add the dependentAssembly section for CefSharp.OffScreen if missing. -->
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x64' and asmv1:assemblyIdentity/@name='CefSharp.OffScreen')">
<assemblyIdentity name="CefSharp.OffScreen" processorArchitecture="x64" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
</dependentAssembly>

<!-- Add or update the codeBase information for CefSharp.OffScreen. -->
<dependentAssembly xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x64' and asmv1:assemblyIdentity/@name='CefSharp.OffScreen')">
<!-- Add the codeBase section if missing. -->
<codeBase xdt:Transform="InsertIfMissing"/>
<!-- Ensure the codeBase version and href are set to the correct values. -->
<codeBase xdt:Transform="Replace" version="83.4.3.0" href="x64/CefSharp.OffScreen.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
27 changes: 27 additions & 0 deletions NuGet/CefSharp.OffScreen.app.config.x86.transform
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1">
<!-- Add the runtime section if missing. -->
<runtime xdt:Transform="InsertIfMissing"/>

<runtime>
<!-- Add the assemblyBinding section if missing. -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" xdt:Transform="InsertIfMissing"/>
</runtime>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- Add the dependentAssembly section for CefSharp.OffScreen if missing. -->
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x86' and asmv1:assemblyIdentity/@name='CefSharp.OffScreen')">
<assemblyIdentity name="CefSharp.OffScreen" processorArchitecture="x86" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
</dependentAssembly>

<!-- Add or update the codeBase information for CefSharp.OffScreen. -->
<dependentAssembly xdt:Locator="Condition(asmv1:assemblyIdentity/@processorArchitecture='x86' and asmv1:assemblyIdentity/@name='CefSharp.OffScreen')">
<!-- Add the codeBase section if missing. -->
<codeBase xdt:Transform="InsertIfMissing"/>
<!-- Ensure the codeBase version and href are set to the correct values. -->
<codeBase xdt:Transform="Replace" version="83.4.3.0" href="x86/CefSharp.OffScreen.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
2 changes: 2 additions & 0 deletions NuGet/CefSharp.OffScreen.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

<file src="CefSharp.OffScreen.props" target="build" />
<file src="CefSharp.OffScreen.targets" target="build" />
<file src="CefSharp.OffScreen.app.config.x64.transform" target="build\app.config.x64.transform" />
<file src="CefSharp.OffScreen.app.config.x86.transform" target="build\app.config.x86.transform" />

<file src="Readme.txt" target="" />

Expand Down
Loading