[msbuild] Build the MSBuild task assemblies for netstandard2.0.#7706
Conversation
New commits in xamarin/Xamarin.MacDev: * dotnet/macios-devtools@210c664 Adds net451 to Xamarin.MacDev.csproj * dotnet/macios-devtools@64db365 [winios] Changes provisioning profiles default path * dotnet/macios-devtools@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (dotnet#68) Diff: https://github.com/xamarin/Xamarin.MacDev/compare/0f578f51e63b6ff93014782dbc9378e6b6bc6d75..210c664e56117d3a1a7f6dd002109eb444dbdc17
The older version doesn't support netstandard2.0. No code changes were required.
Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac.
…sts for both netstandard2.0 and net461. Use custom project configurations to support running the tests for when the tasks assembly is built for netstandard2.0 and net461.
…oth netstandard2.0 and net461.
…er netstandard2.0 or net461.
|
Build failure Test results52 tests failed, 38 tests passed.Failed tests
|
Ask MSBuild to copy lib assemblies to the output folder when building for netstandard2.0, this way we can easily find the actual implementation libraries to pass to ILRepack.
|
Build failure Test results29 tests failed, 61 tests passed.Failed tests
|
|
Build success |
|
Test failures are unrelated
|
| <NetstandardDirectory>@(NetstandardPath)</NetstandardDirectory> | ||
| </PropertyGroup> | ||
| <!-- The assemblies are in a very different place when building for netstandard2.0, which means we need different logic to find them too --> | ||
| <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> |
There was a problem hiding this comment.
Should this be $(TargetFramework.StartsWith('netstandard')) instead to make it more future-proof?
| <MergedAssemblies Include="@(ReferencePath)" Condition="'%(FileName)' == 'Mono.Posix.NETStandard'" /> | ||
| <MergedAssemblies Include="@(ReferencePath)" Condition="'%(Extension)' == '.dll' And $([System.String]::new('%(FileName)').StartsWith('Mono.Cecil', StringComparison.OrdinalIgnoreCase))" /> | ||
| </ItemGroup> | ||
| <ItemGroup Condition="'$(TargetFramework)' == 'net461'"> |
There was a problem hiding this comment.
Ditto here, $(TargetFramework.StartsWith('net4'))? (since VSM and most other libs are already starting to target net472 instead?)
| </ItemGroup> | ||
| <ItemGroup Condition="'$(TargetFramework)' == 'net461'"> | ||
| <MergedAssemblies Include="@(ReferenceCopyLocalPaths)" Condition="'%(Extension)' == '.dll' | ||
| And !$([System.String]::new('%(FileName)').EndsWith('.resources', StringComparison.OrdinalIgnoreCase)) |
There was a problem hiding this comment.
I usually prefer [MSBuild]::ValueOrDefault which doesn't incur a string allocation. In this case, it would be: !$([MSBuild]::ValueOrDefault('%(FileName)', '').EndsWith('.resources', StringComparison.OrdinalIgnoreCase)).
See dotnet/msbuild#4615 for more context too.
|
Sorry for the late review @rolfbjarne, but they are minor improvements anyway. 👍 |
According to review of dotnet#7706.
|
@kzu,
Thanks! Suggested edits: Fixed in #7790. |
According to review of #7706.
This is a necessary step towards making the task assemblies work with .NET 5.
The old code (to build for net461) is still present, and it's easy to switch
back if need be. Eventually the old code should be removed.
Best reviewed commit-by-commit.