Skip to content

Commit

Permalink
fix: Restore compatibility with net5 and net5.0 Target Frameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Nov 12, 2020
1 parent 8a218ea commit f1b727b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
49 changes: 33 additions & 16 deletions src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<Project>

<PropertyGroup>
<_packageBinaryPath>$(MSBuildThisFileDirectory)../tools/Uno.Wasm.Bootstrap.v0.dll</_packageBinaryPath>
<_packageBinaryPath>$(MSBuildThisFileDirectory)../tools/Uno.Wasm.Bootstrap.v1234.dll</_packageBinaryPath>

<WasmShellTasksPath Condition="!Exists('$(_packageBinaryPath)')">$(MSBuildThisFileDirectory)../bin/$(Configuration)/netstandard2.0</WasmShellTasksPath>
<WasmShellTasksPath Condition="Exists('$(_packageBinaryPath)')">../tools</WasmShellTasksPath>
Expand Down Expand Up @@ -56,15 +56,32 @@

<!-- Compatibility with previous version of the task using WasmShellEnableAOT -->
<WasmShellMonoRuntimeExecutionMode Condition="'$(WasmShellEnableAOT)'=='true'">FullAOT</WasmShellMonoRuntimeExecutionMode>

<_WasmShellIsNetCore Condition="'$(TargetFramework)'=='net5' or '$(TargetFramework)'=='net6'">true</_WasmShellIsNetCore>
</PropertyGroup>

<ItemGroup Condition="'$(_WasmShellIsNetCore)'=='true'">
<!-- Remove all the AspNetCore references so we can use them in the output -->
<FrameworkReference Remove="Microsoft.AspNetCore.App" IsImplicitlyDefined="true" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.0-rc.2.20475.5" />
</ItemGroup>


<!--
============================================================
WasmBootstrapAdjustFrameworkReference
Adjusts the FrameworkReference and PackageReference itemgroups
since an Uno Bootstrapp-built app is not an ASP.NET Framemwork app
but we still need the build tooling of Microsoft.NET.Sdk.Web sdk.
============================================================
-->
<Target Name="WasmBootstrapAdjustFrameworkReference" BeforeTargets="ProcessFrameworkReferences">
<PropertyGroup>
<_WasmShellIsNetCore Condition="'$(TargetFrameworkIdentifier)'=='.NETCoreApp' and '$(TargetFrameworkVersion.Substring(1))'&gt;='5.0'">true</_WasmShellIsNetCore>
</PropertyGroup>

<ItemGroup Condition="'$(_WasmShellIsNetCore)'=='true'">
<!--
Remove all the AspNetCore references so we can use actual package references
ASP.NET automatically references (and removes the associated PackageReference
items added explicitly by the building project.
-->
<FrameworkReference Remove="Microsoft.AspNetCore.App" IsImplicitlyDefined="true" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.0-rc.2.20475.5" />
</ItemGroup>
</Target>

<ItemGroup>
<!-- Default compressed extensions when WasmShellGenerateCompressedFiles is enabled -->
Expand All @@ -80,8 +97,8 @@
<UpToDateCheckInput Include="@(LinkerDescriptor)" />
</ItemGroup>

<UsingTask AssemblyFile="$(WasmShellTasksPath)/Uno.Wasm.Bootstrap.v0.dll" TaskName="Uno.Wasm.Bootstrap.ShellTask_v0" />
<UsingTask AssemblyFile="$(WasmShellTasksPath)/Uno.Wasm.Bootstrap.v0.dll" TaskName="Uno.Wasm.Bootstrap.UnoInstallSDKTask_v0" />
<UsingTask AssemblyFile="$(WasmShellTasksPath)/Uno.Wasm.Bootstrap.v1234.dll" TaskName="Uno.Wasm.Bootstrap.ShellTask_v1234" />
<UsingTask AssemblyFile="$(WasmShellTasksPath)/Uno.Wasm.Bootstrap.v1234.dll" TaskName="Uno.Wasm.Bootstrap.UnoInstallSDKTask_v1234" />

<Target Name="_GenerateLinkerDescriptor" BeforeTargets="PrepareForBuild">
<!--
Expand Down Expand Up @@ -119,7 +136,7 @@
<WasmShellDistPath Condition="'$(WasmShellDistPath)'==''">$(OutputPath)/dist</WasmShellDistPath>
</PropertyGroup>

<UnoInstallSDKTask_v0
<UnoInstallSDKTask_v1234
MonoWasmSDKUri="$(MonoWasmSDKUri)"
MonoWasmAOTSDKUri="$(MonoWasmAOTSDKUri)"
NetCoreWasmSDKUri="$(NetCoreWasmSDKUri)"
Expand All @@ -138,9 +155,9 @@
<Output TaskParameter="SdkPath" PropertyName="_UnoMonoSdkPath" />
<Output TaskParameter="PackagerBinPath" PropertyName="_UnoMonoPackagerBinPath" />
<Output TaskParameter="PackagerProjectFile" PropertyName="_UnoMonoPackagerProjectFile" />
</UnoInstallSDKTask_v0>
</UnoInstallSDKTask_v1234>

<ShellTask_v0
<ShellTask_v1234
CurrentProjectPath="$(MSBuildProjectDirectory)"
BuildTaskBasePath="$(MSBuildThisFileDirectory)"
Assembly="$(IntermediateOutputPath)$(TargetFileName)"
Expand Down Expand Up @@ -182,7 +199,7 @@
ReferencePath="@(_UnoWasmBootstrapAssembliesForReferenceCopyLocalPaths)">
<Output TaskParameter="OutputPackagePath" PropertyName="WasmShellOutputPackagePath" />
<Output TaskParameter="OutputDistPath" PropertyName="WasmShellOutputDistPath" />
</ShellTask_v0>
</ShellTask_v1234>
</Target>

<Target Name="_CleanDist" BeforeTargets="Clean">
Expand Down
2 changes: 2 additions & 0 deletions src/Uno.Wasm.SampleNet5/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ static void Main(string[] args)

Console.WriteLine($"Timezone: {TimeZoneInfo.Local.StandardName}");

Console.WriteLine(typeof(Microsoft.Extensions.Logging.Abstractions.NullLogger));

var t = new Timer(_ => {
Console.WriteLine("message");
}, null, 5000, 5000);
Expand Down
6 changes: 4 additions & 2 deletions src/Uno.Wasm.SampleNet5/Uno.Wasm.SampleNet5.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
<StartupObject>Uno.Wasm.Sample.Program</StartupObject>
<!--<WasmShellMonoRuntimeExecutionMode>InterpreterAndAOT</WasmShellMonoRuntimeExecutionMode>-->
<!--<WasmShellEnableEmccProfiling>true</WasmShellEnableEmccProfiling>-->
<!--<WasmPWAManifestFile>manifest.json</WasmPWAManifestFile>-->
<!--<WasmShellGenerateAOTProfile>true</WasmShellGenerateAOTProfile>-->
<MonoRuntimeDebuggerEnabled Condition="'$(Configuration)'=='Debug'">true</MonoRuntimeDebuggerEnabled>
<WasmShellILLinkerEnabled>false</WasmShellILLinkerEnabled>
<WasmShellEnableEmccProfiling>true</WasmShellEnableEmccProfiling>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.14.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="1.4.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.1.1" />
</ItemGroup>

<Import Project="..\Uno.Wasm.Bootstrap\build\Uno.Wasm.Bootstrap.targets" />
Expand Down

0 comments on commit f1b727b

Please sign in to comment.