-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dotnet] Implement support for building net6.0-* apps with .NET 7. Fixes
#15672. (#15761) [dotnet] Implement support for building net6.0-* apps with .NET 7. Fixes #15672. This required a few changes: * The KnownFrameworkReference now references the exact versions of the ref and runtime packs we're shipping with the sdk pack, instead of telling the build to use whatever version is defined in the workload. * Then in the workload we specify the latest released version of the .NET 6 for the ref and runtime packs. * Finally we add an aliased sdk pack, which points to the .NET 6 sdk pack, and when we're building a .NET 6 TargetFramework we load this aliased sdk pack instead of the one we're shipping with this workload. Putting this together means that: * When we're building a .NET 7 TargetFramework, we load the sdk pack shipped with the workload, which adds a KnownFrameworkReference which references the ref and runtime packs with the same version as the sdk pack. * When we're building a .NET 6 TargetFramework, we load the (aliased) sdk pack which points to the latest stable .NET 6 sdk pack. That sdk pack will add a KnownFrameworkReference that tells the build to use the ref and runtime pack versions specified in the workload - which are now pointing to the .NET 6 ref and runtime pack versions. Thus we use the .NET 6 sdk, ref and runtime packs when building a .NET 6 TargetFramework, and we use the .NET 7 sdk, ref and runtime packs when building a .NET 7 TargetFramework. According to the workload design spec [1], this is supposed to be implemented by using aliased ref and runtime packs, but that doesn't work due to dotnet/sdk#26384. There were a few other related changes: * Bump MonoTouch.Dialog and Touch.Unit to a get a version where the project files uses 'net6.0'. This way these projects partly work as tests. * We need to remove any global nfloat usings added by any .NET 6 packs because we implement the same functionality different in .NET 7 (and they clash). * Add a test. #15672. [1]: https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-manifest.md#side-by-side-workload-pattern
- Loading branch information
Showing
34 changed files
with
329 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
dotnet/Workloads/Microsoft.NET.Sdk.MacCatalyst/WorkloadManifest.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
dotnet/Workloads/Microsoft.NET.Sdk.iOS/WorkloadManifest.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
dotnet/Workloads/Microsoft.NET.Sdk.macOS/WorkloadManifest.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
dotnet/Workloads/Microsoft.NET.Sdk.tvOS/WorkloadManifest.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp | ||
|
||
// arguments are: <platform> <outputPath> | ||
|
||
using System.IO; | ||
using System.Xml; | ||
|
||
var args = Environment.GetCommandLineArgs (); | ||
var expectedArgumentCount = 6; | ||
if (args.Length != expectedArgumentCount + 2 /* 2 default arguments (executable + script) + 'expectedArgumentCount' arguments we're interested in */) { | ||
// first arg is "/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/4.5/csharp.exe" | ||
// second arg the script itself | ||
// then comes the ones we care about | ||
Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length - 2}"); | ||
Environment.Exit (1); | ||
return; | ||
} | ||
|
||
var argumentIndex = 2; | ||
var platform = args [argumentIndex++]; | ||
var version = args [argumentIndex++]; | ||
var net6Version = args [argumentIndex++]; | ||
var runtimeIdentifiers = args [argumentIndex++].Split (' '); | ||
var outputPath = args [argumentIndex++]; | ||
var windowsPlatforms = args [argumentIndex++].Split (' '); | ||
var hasWindows = Array.IndexOf (windowsPlatforms, platform) >= 0; | ||
|
||
var platformLowerCase = platform.ToLowerInvariant (); | ||
|
||
using (TextWriter writer = new StreamWriter (outputPath)) { | ||
writer.WriteLine ($"{{"); | ||
writer.WriteLine ($" \"version\": \"{version}\","); | ||
writer.WriteLine ($" \"workloads\": {{"); | ||
writer.WriteLine ($" \"{platformLowerCase}\": {{"); | ||
writer.WriteLine ($" \"description\": \".NET SDK Workload for building {platform} applications.\","); | ||
writer.WriteLine ($" \"packs\": ["); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Sdk.net7\","); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Sdk.net6\","); | ||
if (hasWindows) { | ||
writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.net7\","); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.net6\","); | ||
} | ||
writer.WriteLine ($" \"Microsoft.{platform}.Ref.net7\","); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Ref\","); | ||
foreach (var rid in runtimeIdentifiers) { | ||
writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.net7\","); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}\","); | ||
} | ||
writer.WriteLine ($" \"Microsoft.{platform}.Templates.net7\""); | ||
writer.WriteLine ($" ],"); | ||
writer.WriteLine ($" \"extends\": ["); | ||
if (platform == "macOS") { | ||
writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling\","); | ||
writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling-net6\","); | ||
} else { | ||
writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}\","); | ||
writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}-net6\","); | ||
} | ||
writer.WriteLine ($" ]"); | ||
writer.WriteLine ($" }},"); | ||
writer.WriteLine ($" }},"); | ||
writer.WriteLine ($" \"packs\": {{"); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Sdk.net7\": {{"); | ||
writer.WriteLine ($" \"kind\": \"sdk\","); | ||
writer.WriteLine ($" \"version\": \"{version}\","); | ||
writer.WriteLine ($" \"alias-to\": {{"); | ||
writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Sdk\""); | ||
writer.WriteLine ($" }}"); | ||
writer.WriteLine ($" }},"); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Sdk.net6\": {{"); | ||
writer.WriteLine ($" \"kind\": \"sdk\","); | ||
writer.WriteLine ($" \"version\": \"{net6Version}\","); | ||
writer.WriteLine ($" \"alias-to\": {{"); | ||
writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Sdk\""); | ||
writer.WriteLine ($" }}"); | ||
writer.WriteLine ($" }},"); | ||
if (hasWindows) { | ||
writer.WriteLine ($" \"Microsoft.@[email protected]\": {{"); | ||
writer.WriteLine ($" \"kind\": \"sdk\","); | ||
writer.WriteLine ($" \"version\": \"{version}\","); | ||
writer.WriteLine ($" \"alias-to\": {{"); | ||
writer.WriteLine ($" \"win-x64\": \"Microsoft.{platform}.Windows.Sdk\","); | ||
writer.WriteLine ($" \"win-x86\": \"Microsoft.{platform}.Windows.Sdk\","); | ||
writer.WriteLine ($" \"win-arm64\": \"Microsoft.{platform}.Windows.Sdk\","); | ||
writer.WriteLine ($" }}"); | ||
writer.WriteLine ($" }},"); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.net6\": {{"); | ||
writer.WriteLine ($" \"kind\": \"sdk\","); | ||
writer.WriteLine ($" \"version\": \"{net6Version}\","); | ||
writer.WriteLine ($" \"alias-to\": {{"); | ||
writer.WriteLine ($" \"win-x64\": \"Microsoft.{platform}.Windows.Sdk\","); | ||
writer.WriteLine ($" \"win-x86\": \"Microsoft.{platform}.Windows.Sdk\","); | ||
writer.WriteLine ($" \"win-arm64\": \"Microsoft.{platform}.Windows.Sdk\","); | ||
writer.WriteLine ($" }}"); | ||
writer.WriteLine ($" }},"); | ||
} | ||
writer.WriteLine ($" // The ref and runtime packs use the .net6 version, because when we load the .net6 SDK pack, it says to use the ref and runtime pack versions from the workload (**FromWorkload**)."); | ||
writer.WriteLine ($" // This could be solvable with aliases as well, except that aliases doesn't work in this scenario (https://github.com/dotnet/sdk/issues/26384)."); | ||
writer.WriteLine ($" // For the .net7 packs, we're stating the exact version to use in the KnownFrameworkReference item, so whatever we specify here is ignored."); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Ref\": {{"); | ||
writer.WriteLine ($" \"kind\": \"framework\","); | ||
writer.WriteLine ($" \"version\": \"{net6Version}\""); | ||
writer.WriteLine ($" }},"); | ||
writer.WriteLine ($" \"Microsoft.{platform}.Ref.net7\": {{"); | ||
writer.WriteLine ($" \"kind\": \"framework\","); | ||
writer.WriteLine ($" \"version\": \"{version}\","); | ||
writer.WriteLine ($" \"alias-to\": {{"); | ||
writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Ref\","); | ||
writer.WriteLine ($" }}"); | ||
writer.WriteLine ($" }},"); | ||
foreach (var rid in runtimeIdentifiers) { | ||
writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}\": {{"); | ||
writer.WriteLine ($" \"kind\": \"framework\","); | ||
writer.WriteLine ($" \"version\": \"{net6Version}\""); | ||
writer.WriteLine ($" }},"); | ||
} | ||
foreach (var rid in runtimeIdentifiers) { | ||
writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.net7\": {{"); | ||
writer.WriteLine ($" \"kind\": \"framework\","); | ||
writer.WriteLine ($" \"version\": \"{version}\","); | ||
writer.WriteLine ($" \"alias-to\": {{"); | ||
writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Runtime.{rid}\","); | ||
writer.WriteLine ($" }}"); | ||
writer.WriteLine ($" }},"); | ||
} | ||
writer.WriteLine ($" \"Microsoft.{platform}.Templates.net7\": {{"); | ||
writer.WriteLine ($" \"kind\": \"template\","); | ||
writer.WriteLine ($" \"version\": \"{version}\","); | ||
writer.WriteLine ($" \"alias-to\": {{"); | ||
writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Templates\","); | ||
writer.WriteLine ($" }}"); | ||
writer.WriteLine ($" }}"); | ||
writer.WriteLine ($" }}"); | ||
writer.WriteLine ($"}}"); | ||
} | ||
|
||
Environment.Exit (0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,20 @@ | |
|
||
<ItemGroup>@VALID_RUNTIME_IDENTIFIERS@ | ||
</ItemGroup> | ||
|
||
<!-- Declare the XI/XM framework bundled with this version of the SDK. See Microsoft.NETCoreSdk.BundledVersions.props --> | ||
<ItemGroup> | ||
<KnownFrameworkReference | ||
Include="Microsoft.@PLATFORM@" | ||
TargetFramework="@DOTNET_TFM@" | ||
RuntimeFrameworkName="Microsoft.@PLATFORM@" | ||
DefaultRuntimeFrameworkVersion="@NUGET_VERSION_NO_METADATA@" | ||
LatestRuntimeFrameworkVersion="@NUGET_VERSION_NO_METADATA@" | ||
TargetingPackName="Microsoft.@[email protected]" | ||
TargetingPackVersion="@NUGET_VERSION_NO_METADATA@" | ||
RuntimePackNamePatterns="Microsoft.@[email protected].**RID**" | ||
RuntimePackRuntimeIdentifiers="@RUNTIME_PACK_RUNTIME_IDENTIFIERS@" | ||
Profile="@PLATFORM@" | ||
/> | ||
</ItemGroup> | ||
</Project> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
5ef440f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 [CI Build] Build failed 🔥
Build failed for the job 'Detect API changes'
Pipeline on Agent
Hash: [CI build]
5ef440f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 Unable to find the contents for the comment: D:\a\1\s\change-detection\results\gh-comment.md does not exist :fire
Pipeline on Agent
Hash: 5ef440faae8bceada9babcb915f5f3d31ed47b5b [CI build]
5ef440f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💻 [CI Build] Tests on macOS Mac Catalina (10.15) passed 💻
✅ All tests on macOS Mac Catalina (10.15) passed.
Pipeline on Agent
Hash: 5ef440faae8bceada9babcb915f5f3d31ed47b5b [CI build]
5ef440f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ [CI Build] Tests on macOS M1 - Mac Big Sur (11.5) failed ❌
Failed tests are:
Pipeline on Agent
Hash: 5ef440faae8bceada9babcb915f5f3d31ed47b5b [CI build]
5ef440f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📚 [CI Build] Artifacts 📚
Packages generated
View packages
Pipeline on Agent XAMMINI-053.Monterey'
Hash: 5ef440faae8bceada9babcb915f5f3d31ed47b5b [CI build]
5ef440f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 [CI Build] Test results 🔥
Test results
❌ Tests failed on VSTS: simulator tests
0 tests crashed, 2 tests failed, 221 tests passed.
Failures
❌ mmp tests
Html Report (VSDrops) Download
❌ monotouch tests
Tests run: 2759 Passed: 2648 Inconclusive: 9 Failed: 1 Ignored: 110)
Html Report (VSDrops) Download
Successes
✅ bcl: All 69 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 7 tests passed. Html Report (VSDrops) Download
✅ install_source: All 1 tests passed. Html Report (VSDrops) Download
✅ introspection: All 8 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac_binding_project: All 1 tests passed. Html Report (VSDrops) Download
✅ mononative: All 12 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download
Pipeline on Agent
Hash: [CI build]