116 lines
14 KiB
XML
116 lines
14 KiB
XML
<?xml version="1.0"?>
|
||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||
<!-- The Platform property is Win32 or x64 for C++ projects. Convert from Win32 to x86 to match our directory structure.
|
||
If PlatformTarget property is set, then use that to determine EffectivePlatform for .NET projects.
|
||
See conditions: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-conditions?view=vs-2019
|
||
and PropertyGroup: https://docs.microsoft.com/en-us/visualstudio/msbuild/propertygroup-element-msbuild?view=vs-2019
|
||
-->
|
||
<PropertyGroup>
|
||
<EffectivePlatform>$(Platform)</EffectivePlatform>
|
||
<EffectivePlatform Condition="'$(Platform)' == 'Win32'">x86</EffectivePlatform>
|
||
<EffectivePlatform Condition="'$(Platform)' == 'Any CPU'">x86</EffectivePlatform>
|
||
<EffectivePlatform Condition="'$(Platform)' == 'AnyCPU'">x86</EffectivePlatform>
|
||
<EffectivePlatform Condition="'$(NETCoreSdkRuntimeIdentifier)' == 'win-x86'">x86</EffectivePlatform>
|
||
<EffectivePlatform Condition="'$(NETCoreSdkRuntimeIdentifier)' == 'win-x64'">x64</EffectivePlatform>
|
||
<EffectivePlatform Condition="'$(PlatformTarget)' == 'x64'">x64</EffectivePlatform>
|
||
<EffectivePlatform Condition="'$(PlatformTarget)' == 'x86'">x86</EffectivePlatform>
|
||
<EffectivePlatform Condition="'$(PlatformTarget)' == 'Any CPU'">anycpu</EffectivePlatform>
|
||
<EffectivePlatform Condition="'$(PlatformTarget)' == 'AnyCPU'">anycpu</EffectivePlatform>
|
||
</PropertyGroup>
|
||
|
||
<!-- Define custom property to provide user ability to switch between loader static lib or dll.
|
||
Dynamic value to dll, Static value to static lib
|
||
See MSBuild properties: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-properties?view=vs-2019
|
||
-->
|
||
<PropertyGroup>
|
||
<WebView2LoaderPreference>Dynamic</WebView2LoaderPreference>
|
||
</PropertyGroup>
|
||
|
||
<!-- Make our header path available in the include path.
|
||
See CL task: https://docs.microsoft.com/en-us/visualstudio/msbuild/cl-task?view=vs-2019
|
||
-->
|
||
<ItemDefinitionGroup>
|
||
<ClCompile>
|
||
<!-- MSBuildThisFileDirectory is the path containing this targets file.
|
||
See well-known properties: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2019
|
||
-->
|
||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||
</ClCompile>
|
||
</ItemDefinitionGroup>
|
||
|
||
<!-- Update link path to include appropriate arch directory and link against our lib.
|
||
See Link task: https://docs.microsoft.com/en-us/visualstudio/msbuild/link-task?view=vs-2019
|
||
-->
|
||
<ItemDefinitionGroup>
|
||
<Link>
|
||
<WebView2LoaderLib Condition="'$(WebView2LoaderPreference)' == 'Static'">WebView2LoaderStatic.lib;version.lib</WebView2LoaderLib>
|
||
<AdditionalDependencies>%(WebView2LoaderLib);WebView2Loader.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)native\$(EffectivePlatform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||
</Link>
|
||
</ItemDefinitionGroup>
|
||
|
||
<!-- Copy DLL to the output path.
|
||
Only Copy DLL to the output path when project is C++ and WebView2LoaderPreference is set to Dynamic.
|
||
.NET will pick DLL at runtime from runtime folder or processor bit folder base on Core or Framework.
|
||
See Content: https://docs.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items?view=vs-2019
|
||
See Architecture-specific folders for .NET:
|
||
https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks#architecture-specific-folders
|
||
-->
|
||
<ItemGroup Condition="'$(WebView2LoaderPreference)' == 'Dynamic' And '$(WebView2ProjectKind)' == 'native'">
|
||
<Content Include="$(MSBuildThisFileDirectory)native\$(EffectivePlatform)\WebView2Loader.dll">
|
||
<Link>%(Filename)%(Extension)</Link>
|
||
<PublishState>Included</PublishState>
|
||
<Visible>False</Visible>
|
||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||
</Content>
|
||
</ItemGroup>
|
||
|
||
<!-- Copy x64, x86 and arm64 WebView2Loader.dlls to sub folders in the output path. For .NET Framework we match
|
||
the folder convention used by .NET Core for consistency.
|
||
Microsoft.Web.WebView2.Core.dll handles loading the right DLL at runtime for Any CPU under those sub folders.
|
||
For SDK style project, check for TargetFramework. For msbuild style, check to make sure project is not C++ and TargetFrameworkVersion equal to v after trimming all numbers and dots.
|
||
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-target-framework-and-target-platform?view=vs-2019#target-framework-and-profile
|
||
-->
|
||
<ItemGroup Condition="'$(WebView2ProjectKind)' == 'managed' And '$(TargetPlatformIdentifier)' != 'UAP'">
|
||
<Content Include="$(MSBuildThisFileDirectory)\..\runtimes\win-x86\native\WebView2Loader.dll" Condition="'$(EffectivePlatform)' == 'x86' Or '$(EffectivePlatform)' == 'anycpu'">
|
||
<Link>runtimes\win-x86\native\WebView2Loader.dll</Link>
|
||
<PublishState>Included</PublishState>
|
||
<Visible>False</Visible>
|
||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||
<IncludeInVsix>true</IncludeInVsix>
|
||
</Content>
|
||
<Content Include="$(MSBuildThisFileDirectory)\..\runtimes\win-x64\native\WebView2Loader.dll" Condition="'$(EffectivePlatform)' == 'x64' Or '$(EffectivePlatform)' == 'anycpu'">
|
||
<Link>runtimes\win-x64\native\WebView2Loader.dll</Link>
|
||
<PublishState>Included</PublishState>
|
||
<Visible>False</Visible>
|
||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||
<IncludeInVsix>true</IncludeInVsix>
|
||
</Content>
|
||
<Content Include="$(MSBuildThisFileDirectory)\..\runtimes\win-arm64\native\WebView2Loader.dll" Condition="'$(EffectivePlatform)' == 'arm64' Or '$(EffectivePlatform)' == 'anycpu'">
|
||
<Link>runtimes\win-arm64\native\WebView2Loader.dll</Link>
|
||
<PublishState>Included</PublishState>
|
||
<Visible>False</Visible>
|
||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||
<IncludeInVsix>true</IncludeInVsix>
|
||
</Content>
|
||
</ItemGroup>
|
||
|
||
<!-- Setup UWP DLLs.
|
||
See: https://docs.microsoft.com/en-us/nuget/guides/create-uwp-packages
|
||
-->
|
||
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
|
||
<Reference Include="$(MSBuildThisFileDirectory)..\lib\Microsoft.Web.WebView2.Core.winmd">
|
||
<Implementation>Microsoft.Web.WebView2.Core.dll</Implementation>
|
||
</Reference>
|
||
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\runtimes\win-$(EffectivePlatform)\native_uap\Microsoft.Web.WebView2.Core.dll" />
|
||
<SDKReference Include="Microsoft.VCLibs.Desktop, Version=14.0"/>
|
||
</ItemGroup>
|
||
|
||
<!-- Cleanup our copied files when cleaning.
|
||
See Delete: https://docs.microsoft.com/en-us/visualstudio/msbuild/delete-task?view=vs-2019
|
||
See AfterTargets: https://docs.microsoft.com/en-us/visualstudio/msbuild/target-build-order?view=vs-2019
|
||
-->
|
||
<Target Name="CleanDownloadContentFiles" AfterTargets="Clean">
|
||
<Delete Files="$(OutputPath)\WebView2Loader.dll"/>
|
||
</Target>
|
||
</Project> |