Skip to content
Permalink
Browse files

[Build] Various fixes for .NET Standard build

  • Loading branch information
xen2 committed Dec 23, 2018
1 parent a999932 commit 4780b504bdb6f3277744c96632e2862fc8a55dd6
Showing with 22 additions and 19 deletions.
  1. +14 −3 sources/targets/Xenko.Core.PreSettings.targets
  2. +8 −16 sources/targets/Xenko.GlobalSettings.targets
@@ -1,5 +1,5 @@
<!-- Build file pre-included by all Xenko projects -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="RuntimeIdentifier">
<!-- Setup this part according to your project if you want your .csproj to compile individually without going through the .sln file -->
<PropertyGroup>
<SolutionDir Condition=" '$(SolutionDir)' == '' ">$(MSBuildThisFileDirectory)..\..\build\</SolutionDir>
@@ -26,6 +26,14 @@
<XenkoPlatforms>$([MSBuild]::Unescape('$(XenkoPlatforms)'))</XenkoPlatforms>
<_XenkoPlatforms>;$(XenkoPlatforms);</_XenkoPlatforms>
</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework.StartsWith('uap10.0'))">
<!-- Reset runtime identifier by default (otherwise GetPackagingOutputs fail) -->
<RuntimeIdentifier></RuntimeIdentifier>
<WindowsAppContainer>false</WindowsAppContainer>
<AppxPackage>false</AppxPackage>
<Platform>AnyCPU</Platform>
</PropertyGroup>

<PropertyGroup Condition=" '$(XenkoRuntime)' == 'true' And '$(XenkoRuntimeNetStandard)' != 'true' ">
<!-- Add netstandard2.0 no matter what (needed for references) -->
@@ -39,6 +47,9 @@
<!-- We compile linux version as "ref" if XenkoRuntimeWindowsDotNet is true (otherwise single platform build wouldn't work) -->
<XenkoRuntimeIdentifiers Condition="'$(XenkoRuntimeNetStandardNoRuntimeIdentifiers)' != 'true' And '$(TargetFramework)' == 'netstandard2.0' And $(_XenkoPlatforms.Contains(';Linux;'))">$(XenkoRuntimeIdentifiers);linux</XenkoRuntimeIdentifiers>

<!-- Need to use "win" runtime identifier for all other platforms as a workaround https://github.com/NuGet/Home/issues/7661#issuecomment-450040204 -->
<XenkoRuntimeIdentifiers Condition="'$(XenkoRuntimeNetStandardNoRuntimeIdentifiers)' != 'true' And '$(TargetFramework)' != 'netstandard2.0'">win</XenkoRuntimeIdentifiers>

<XenkoRuntimeTargetFrameworks>$([MSBuild]::Unescape($(XenkoRuntimeTargetFrameworks.Trim(';'))))</XenkoRuntimeTargetFrameworks>
<XenkoRuntimeIdentifiers>$([MSBuild]::Unescape($(XenkoRuntimeIdentifiers.Trim(';'))))</XenkoRuntimeIdentifiers>

@@ -60,9 +71,9 @@

<!-- Use default runtime as ref assembly -->
<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);XenkoIncludeRefAssemblies</TargetsForTfmSpecificBuildOutput>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);_XenkoIncludeRefAssemblies</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target Name="XenkoIncludeRefAssemblies" Condition="'$(RuntimeIdentifiers)' != '' And '$(RuntimeIdentifier)' == $(RuntimeIdentifiers.Split(';')[0])">
<Target Name="_XenkoIncludeRefAssemblies" Condition="'$(RuntimeIdentifiers)' != '' And '$(RuntimeIdentifier)' == $(RuntimeIdentifiers.Split(';')[0])">
<ItemGroup>
<TfmSpecificPackageFile Include="@(IntermediateAssembly)" PackagePath="ref/$(TargetFramework)" />
</ItemGroup>
@@ -46,11 +46,12 @@
<RuntimeIdentifierDefault Condition="'$(RuntimeIdentifiers)' != ''">$(RuntimeIdentifiers.Split(';')[0])</RuntimeIdentifierDefault>

<ExtrasBuildEachRuntimeIdentifier Condition="'$(RuntimeIdentifiers)' != ''">true</ExtrasBuildEachRuntimeIdentifier>
<!--<DisableFastUpToDateCheck Condition="$(RuntimeIdentifiers.Contains(';'))">true</DisableFastUpToDateCheck>-->

<!-- Compute RuntimeIdentifier (it might be different if passed from a ProjectReference) -->
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == '' And '$(RuntimeIdentifierDefault)' != ''">$(RuntimeIdentifierDefault)</RuntimeIdentifier>

<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == 'win'">win-d3d11</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == 'linux'">linux-opengl</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(XenkoPlatform)' == 'Windows' And '$(RuntimeIdentifier)' == 'win'">win-d3d11</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(XenkoPlatform)' == 'Linux' And '$(RuntimeIdentifier)' == 'linux'">linux-opengl</RuntimeIdentifier>

<XenkoGraphicsApi Condition="'$(RuntimeIdentifier)' == 'win-d3d11'">Direct3D11</XenkoGraphicsApi>
<XenkoGraphicsApi Condition="'$(RuntimeIdentifier)' == 'win-d3d12'">Direct3D12</XenkoGraphicsApi>
@@ -62,20 +63,11 @@
<XenkoGraphicsApi Condition="'$(RuntimeIdentifier)' == 'linux-vulkan'">Vulkan</XenkoGraphicsApi>
</PropertyGroup>

<!-- Use default runtime as ref assembly -->
<PropertyGroup Condition="'$(XenkoGraphicsApiDependent)' == 'true' And '$(XenkoGraphicsApiDependentBuildAll)' == 'true' And ('$(RuntimeIdentifierDefault)' == '' Or '$(RuntimeIdentifier)' == '$(RuntimeIdentifierDefault)')">
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);XenkoIncludeRefAssemblies</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target Name="XenkoIncludeRefAssemblies">
<ItemGroup>
<TfmSpecificPackageFile Include="@(IntermediateAssembly)" PackagePath="ref/$(TargetFramework)" />
</ItemGroup>
</Target>

<!-- Workaround: Remove RuntimeIdentifier from Solution references (https://github.com/onovotny/MSBuildSdkExtras/issues/139) -->
<Target Name="_XenkoRemoveRuntimeIdentifierFromSolutionDependencies" AfterTargets="AssignProjectConfiguration">
<!-- Workaround: Remove RuntimeIdentifier from Solution references (https://github.com/onovotny/MSBuildSdkExtras/issues/139)
additionally, also remove it from all references to avoid issues -->
<Target Name="_XenkoRemoveRuntimeIdentifier" AfterTargets="AssignProjectConfiguration">
<ItemGroup>
<ProjectReferenceWithConfiguration Condition="'%(ProjectReferenceWithConfiguration.ReferenceSourceTarget)' != 'ProjectReference'">
<ProjectReferenceWithConfiguration>
<GlobalPropertiesToRemove>%(ProjectReferenceWithConfiguration.GlobalPropertiesToRemove);RuntimeIdentifier</GlobalPropertiesToRemove>
</ProjectReferenceWithConfiguration>
</ItemGroup>

0 comments on commit 4780b50

Please sign in to comment.
You can’t perform that action at this time.