diff --git a/.nuspec/package.ps1 b/.nuspec/package.ps1 index f343ceecc2fb..ebce762ecff9 100644 --- a/.nuspec/package.ps1 +++ b/.nuspec/package.ps1 @@ -1,6 +1,17 @@ -param ($configuration) +param ([string] $configuration = 'Debug') -dotnet pack $PSScriptRoot\..\Microsoft.Maui-net6.sln ` +$ext = if ($IsWindows) { ".exe" } else { "" } +$dotnet = Join-Path $PSScriptRoot ../bin/dotnet/dotnet$ext +$sln = Join-Path $PSScriptRoot ../Microsoft.Maui-net6.sln +$artifacts = Join-Path $PSScriptRoot ../artifacts + +if (-not (Test-Path $dotnet)) +{ + $csproj = Join-Path $PSScriptRoot ../src/DotNet/DotNet.csproj + & dotnet build $csproj -bl:$artifacts/dotnet.binlog +} + +& $dotnet pack $sln ` -c:$configuration ` -p:SymbolPackageFormat=snupkg ` - -bl:$PSScriptRoot/../artifacts/maui.binlog + -bl:$artifacts/maui.binlog diff --git a/Directory.Build.props b/Directory.Build.props index 605daff70891..35502e76da78 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,4 +1,5 @@ + <_MauiBuildTasksLocation>$(_MauiBuildTasksLocation) <_MauiBuildTasksLocation Condition="'$(_MauiBuildTasksLocation)' == ''">$(MSBuildThisFileDirectory).nuspec\ diff --git a/eng/Version.props b/eng/Version.props new file mode 100644 index 000000000000..18f009150203 --- /dev/null +++ b/eng/Version.props @@ -0,0 +1,9 @@ + + + + 6.0.100-preview.2.21155.3 + 11.0.200-ci.main.148 + 14.3.100-ci.main.337 + 14.4.100-ci.main.1192 + + \ No newline at end of file diff --git a/eng/pipelines/common/build-windows.yml b/eng/pipelines/common/build-windows.yml index 73fb1278c69f..ffe67b6f271a 100644 --- a/eng/pipelines/common/build-windows.yml +++ b/eng/pipelines/common/build-windows.yml @@ -16,7 +16,9 @@ steps: provisioning_script: $(provisionator.path) provisioning_extra_args: $(provisionator.extraArguments) - - template: dotnet-install.yml + - powershell: | + & dotnet build src\DotNet\DotNet.csproj -bl:${{ parameters.artifactsTargetFolder }}\$(BuildConfiguration)-dotnet.binlog + displayName: install .NET - powershell: | $(System.DefaultWorkingDirectory)/build.ps1 --target provision --TeamProject="$(System.TeamProject)" @@ -67,7 +69,7 @@ steps: displayName: 'Copy Files dlls' inputs: Contents: | - **/bin/**/*.dll + src/**/bin/**/*.dll TargetFolder: ${{ parameters.artifactsTargetFolder }} - task: PublishBuildArtifacts@1 diff --git a/eng/pipelines/common/dotnet-install.yml b/eng/pipelines/common/dotnet-install.yml deleted file mode 100644 index c4563b77b5bd..000000000000 --- a/eng/pipelines/common/dotnet-install.yml +++ /dev/null @@ -1,27 +0,0 @@ -# This template enables installation of stable and main/nightly builds of .NET. - -parameters: - version: $(DotNetVersion) - root: $(DotNet.Root) - tools: $(DotNet.Tools) - -steps: - - # Use dotnet-install.ps1 on Windows - - pwsh: | - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1 - & .\dotnet-install.ps1 -Version ${{ parameters.version }} -InstallDir "$env:ProgramFiles\dotnet\" -Verbose - & dotnet --list-sdks - displayName: install .NET ${{ parameters.version }} - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - - # Use dotnet-install.sh on macOS - - bash: > - export PATH="${{ parameters.root }}:${{ parameters.tools }}:$PATH" && - curl -L https://dot.net/v1/dotnet-install.sh > dotnet-install.sh && - sh dotnet-install.sh --version ${{ parameters.version }} --install-dir "${{ parameters.root }}" --verbose && - dotnet --list-sdks && - echo "##vso[task.setvariable variable=PATH]$PATH" - displayName: install .NET ${{ parameters.version }} - condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin')) diff --git a/eng/pipelines/common/variables-net6.yml b/eng/pipelines/common/variables-net6.yml deleted file mode 100644 index 16c3f52a0c34..000000000000 --- a/eng/pipelines/common/variables-net6.yml +++ /dev/null @@ -1,15 +0,0 @@ -variables: - - name: DotNetVersion - value: 6.0.100-preview.2.21155.3 - - name: DotNet.Cli.Telemetry.OptOut - value: true - - name: Android.Msi - value: https://dl.internalx.com/vsts-devdiv/Xamarin.Android/public/net6/4534967/main/f4d8fe238b15eadfc7842749bf13e5fca3e2f2d2/Microsoft.NET.Workload.Android.11.0.200.148.msi - - name: iOS.Msi - value: https://bosstoragemirror.azureedge.net/wrench/main/cc1918e6740610447042acd5867284eb3e27aff5/4538289/package/Microsoft.NET.Workload.iOS.14.4.100-ci.main.1185.msi - - name: Android.Pkg - value: https://dl.internalx.com/vsts-devdiv/Xamarin.Android/public/net6/4534967/main/f4d8fe238b15eadfc7842749bf13e5fca3e2f2d2/Microsoft.NET.Workload.Android-11.0.200-ci.f4d8fe238b15eadfc7842749bf13e5fca3e2f2d2.148.pkg - - name: iOS.Pkg - value: https://bosstoragemirror.azureedge.net/wrench/main/cc1918e6740610447042acd5867284eb3e27aff5/4538289/package/notarized/Microsoft.iOS.Bundle.14.4.100-ci.main.1185.pkg - - name: MacCatalyst.Pkg - value: https://bosstoragemirror.azureedge.net/wrench/main/cc1918e6740610447042acd5867284eb3e27aff5/4538289/package/notarized/Microsoft.MacCatalyst.Bundle.14.3.100-ci.main.330.pkg \ No newline at end of file diff --git a/eng/pipelines/handlers.yml b/eng/pipelines/handlers.yml index 6d1936e92522..4f0bd2e0f9e1 100644 --- a/eng/pipelines/handlers.yml +++ b/eng/pipelines/handlers.yml @@ -46,7 +46,6 @@ schedules: variables: - template: /eng/pipelines/common/variables.yml - - template: /eng/pipelines/common/variables-net6.yml - name: LogDirectory value: $(Build.ArtifactStagingDirectory)/logs - name: provisionator.xcode @@ -55,6 +54,8 @@ variables: value: '$(System.DefaultWorkingDirectory)/eng/provisioning/provisioning.csx' - name: provisionator.extraArguments value: '--v' + - name: DotNet.Path + value: $(System.DefaultWorkingDirectory)/bin/dotnet/dotnet parameters: - name: BuildEverything @@ -145,27 +146,7 @@ stages: pool: name: ${{ BuildPlatform.poolName }} vmImage: ${{ BuildPlatform.vmImage }} - ${{ if eq(BuildPlatform.name, 'macos') }}: - variables: - DotNet.Root: /usr/local/share/dotnet/ - DotNet.Tools: ~/.dotnet/tools steps: - - ${{ if eq(BuildPlatform.name, 'macos') }}: - - task: UseDotNet@2 - displayName: install .NET Core 3.1 - inputs: - version: 3.1.x - installationPath: $(DotNet.Root) - - template: common/dotnet-install.yml - - pwsh: | - dotnet tool install --global boots - boots ${{ BuildPlatform.bootsAndroid }} - boots ${{ BuildPlatform.bootsiOS }} - if ('${{ BuildPlatform.bootsMacCatalyst }}' -ne '') { - boots ${{ BuildPlatform.bootsMacCatalyst }} - } - displayName: install .NET workloads - errorActionPreference: stop - ${{ if eq(BuildPlatform.name, 'macos') }}: - bash: | set -x @@ -210,27 +191,7 @@ stages: pool: name: ${{ BuildPlatform.poolName }} vmImage: ${{ BuildPlatform.vmImage }} - ${{ if eq(BuildPlatform.name, 'macos') }}: - variables: - DotNet.Root: /usr/local/share/dotnet/ - DotNet.Tools: ~/.dotnet/tools steps: - - ${{ if eq(BuildPlatform.name, 'macos') }}: - - task: UseDotNet@2 - displayName: install .NET Core 3.1 - inputs: - version: 3.1.x - installationPath: $(DotNet.Root) - - template: common/dotnet-install.yml - - pwsh: | - dotnet tool install --global boots - boots ${{ BuildPlatform.bootsAndroid }} - boots ${{ BuildPlatform.bootsiOS }} - if ('${{ BuildPlatform.bootsMacCatalyst }}' -ne '') { - boots ${{ BuildPlatform.bootsMacCatalyst }} - } - displayName: install .NET workloads - errorActionPreference: stop - ${{ if eq(BuildPlatform.name, 'macos') }}: - bash: | set -x @@ -240,8 +201,9 @@ stages: cat ~/Library/Preferences/Xamarin/Settings.plist || true displayName: configure vsmac xcode - pwsh: | - dotnet build Microsoft.Maui.BuildTasks-net6.sln -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration)-buildtasks.binlog - dotnet build Microsoft.Maui-net6.sln -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration).binlog + & dotnet build src\DotNet\DotNet.csproj -bl:$(LogDirectory)\$(BuildConfiguration)-dotnet.binlog + & $(DotNet.Path) build Microsoft.Maui.BuildTasks-net6.sln -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration)-buildtasks.binlog + & $(DotNet.Path) build Microsoft.Maui-net6.sln -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration).binlog displayName: build samples errorActionPreference: stop - task: PublishBuildArtifacts@1 diff --git a/src/Compatibility/Core/src/Compatibility-net6.csproj b/src/Compatibility/Core/src/Compatibility-net6.csproj index 3025e1c9d1a1..f415024306b9 100644 --- a/src/Compatibility/Core/src/Compatibility-net6.csproj +++ b/src/Compatibility/Core/src/Compatibility-net6.csproj @@ -1,7 +1,6 @@ - net6.0-ios;net6.0-android - $(TargetFrameworks);net6.0-maccatalyst + net6.0-ios;net6.0-android;net6.0-maccatalyst Microsoft.Maui.Controls.Compatibility Microsoft.Maui.Controls.Compatibility disable diff --git a/src/Controls/samples/Controls.Sample.SingleProject/Maui.Controls.Sample.SingleProject.csproj b/src/Controls/samples/Controls.Sample.SingleProject/Maui.Controls.Sample.SingleProject.csproj index a64e9298eb34..743d8d0aead2 100644 --- a/src/Controls/samples/Controls.Sample.SingleProject/Maui.Controls.Sample.SingleProject.csproj +++ b/src/Controls/samples/Controls.Sample.SingleProject/Maui.Controls.Sample.SingleProject.csproj @@ -1,7 +1,6 @@ - net6.0-android;net6.0-ios - $(TargetFrameworks);net6.0-maccatalyst + net6.0-android;net6.0-maccatalyst;net6.0-ios ios-x64 maccatalyst-x64 Exe diff --git a/src/Controls/samples/Controls.Sample/Maui.Controls.Sample-net6.csproj b/src/Controls/samples/Controls.Sample/Maui.Controls.Sample-net6.csproj index 36e2564c28a5..42a41889932b 100644 --- a/src/Controls/samples/Controls.Sample/Maui.Controls.Sample-net6.csproj +++ b/src/Controls/samples/Controls.Sample/Maui.Controls.Sample-net6.csproj @@ -1,8 +1,7 @@ - net6.0-android;net6.0-ios - $(TargetFrameworks);net6.0-maccatalyst + net6.0-android;net6.0-ios;net6.0-maccatalyst Maui.Controls.Sample Maui.Controls.Sample false diff --git a/src/Controls/src/Core/Controls.Core-net6.csproj b/src/Controls/src/Core/Controls.Core-net6.csproj index c000484ead2b..625da40cab6c 100644 --- a/src/Controls/src/Core/Controls.Core-net6.csproj +++ b/src/Controls/src/Core/Controls.Core-net6.csproj @@ -1,7 +1,6 @@ - netstandard2.0;net6.0;net6.0-android;net6.0-ios - $(TargetFrameworks);net6.0-maccatalyst + netstandard2.0;net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst Microsoft.Maui.Controls Microsoft.Maui.Controls disable diff --git a/src/Controls/src/Xaml/Controls.Xaml-net6.csproj b/src/Controls/src/Xaml/Controls.Xaml-net6.csproj index a28c4c4a334c..8d0b362f0044 100644 --- a/src/Controls/src/Xaml/Controls.Xaml-net6.csproj +++ b/src/Controls/src/Xaml/Controls.Xaml-net6.csproj @@ -1,7 +1,6 @@ - netstandard2.0;net6.0;net6.0-android;net6.0-ios - $(TargetFrameworks);net6.0-maccatalyst + netstandard2.0;net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst Microsoft.Maui.Controls.Xaml Microsoft.Maui.Controls.Xaml $(NoWarn);CA2200; diff --git a/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs b/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs index 6df399219de2..95ff452bfadc 100644 --- a/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs +++ b/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Xml.Linq; using Mono.Cecil; @@ -184,9 +185,25 @@ void onData(object s, DataReceivedEventArgs e) } }; + var ext = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : ""; + var dotnet = IOPath.Combine(testDirectory, "..", "..", "..", "..", "..", "..", "..", "bin", "dotnet", $"dotnet{ext}"); + if (!File.Exists (dotnet)) + { + Console.WriteLine($"Using 'dotnet', did not find: {dotnet}"); + + // If we don't have .\bin\dotnet\dotnet, try the system one + dotnet = "dotnet"; + } + else + { + dotnet = IOPath.GetFullPath(dotnet); + + Console.WriteLine($"Using '{dotnet}'"); + } + var psi = new ProcessStartInfo { - FileName = "dotnet", + FileName = dotnet, Arguments = $"build -v:{verbosity} -nologo {projectFile} -t:{target} -bl {additionalArgs}", CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, diff --git a/src/Core/src/Core-net6.csproj b/src/Core/src/Core-net6.csproj index ba425f47c13c..c8e366e35c72 100644 --- a/src/Core/src/Core-net6.csproj +++ b/src/Core/src/Core-net6.csproj @@ -1,7 +1,6 @@ - netstandard2.1;netstandard2.0;net6.0-android;net6.0-ios - $(TargetFrameworks);net6.0-maccatalyst + netstandard2.1;netstandard2.0;net6.0-android;net6.0-ios;net6.0-maccatalyst Microsoft.Maui Microsoft.Maui enable diff --git a/src/DotNet/Dependencies/Directory.Build.props b/src/DotNet/Dependencies/Directory.Build.props new file mode 100644 index 000000000000..fef28dc83d92 --- /dev/null +++ b/src/DotNet/Dependencies/Directory.Build.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/DotNet/Dependencies/Directory.Build.targets b/src/DotNet/Dependencies/Directory.Build.targets new file mode 100644 index 000000000000..423091616474 --- /dev/null +++ b/src/DotNet/Dependencies/Directory.Build.targets @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/DotNet/Dependencies/Packs.csproj b/src/DotNet/Dependencies/Packs.csproj new file mode 100644 index 000000000000..bf865d4c358e --- /dev/null +++ b/src/DotNet/Dependencies/Packs.csproj @@ -0,0 +1,15 @@ + + + netstandard2.0 + + + + + + + + + + + + \ No newline at end of file diff --git a/src/DotNet/Dependencies/Workloads.csproj b/src/DotNet/Dependencies/Workloads.csproj new file mode 100644 index 000000000000..f0f92362b211 --- /dev/null +++ b/src/DotNet/Dependencies/Workloads.csproj @@ -0,0 +1,10 @@ + + + netstandard2.0 + + + + + + + \ No newline at end of file diff --git a/src/DotNet/DotNet.csproj b/src/DotNet/DotNet.csproj new file mode 100644 index 000000000000..827a4cb2f7b5 --- /dev/null +++ b/src/DotNet/DotNet.csproj @@ -0,0 +1,108 @@ + + + netstandard2.0 + false + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../../bin/')) + $(MauiOutputPath)dotnet/ + $(DotNetDirectory)dotnet + $(DotNetDirectory)packs/ + $(DotNetDirectory)sdk-manifests/$(MicrosoftNETSdkPackageVersion.Split('-')[0])/ + $(DotNetDirectory)sdk/$(MicrosoftNETSdkPackageVersion)/EnableWorkloadResolver.sentinel + + + https://dot.net/v1/dotnet-install.ps1 + dotnet-install.ps1 + $(MauiOutputPath)$(DotNetInstallScriptName) + & '$(DotNetInstallScriptPath)' -Version $(MicrosoftNETSdkPackageVersion) -InstallDir '$(DotNetDirectory)' -Verbose + powershell -Command "$(DotNetInstallCommand)" + + + https://dot.net/v1/dotnet-install.sh + dotnet-install.sh + $(MauiOutputPath)$(DotNetInstallScriptName) + sh '$(DotNetInstallScriptPath)' --version $(MicrosoftNETSdkPackageVersion) --install-dir '$(DotNetDirectory)' --verbose + + + + <_ProvisionDependsOn> + _DownloadDotNetInstallScript; + _InstallDotNet; + _AcquireWorkloads; + _AcquirePacks; + _CreateWorkloadSentinel; + + + + + + + <_Inputs> + $(MSBuildThisFile); + ../../eng/Version.props; + + + + + + + + + + + + + + + + <_PacksToRemove Include="microsoft.build.notargets" /> + <_PacksToRemove Include="microsoft.netcore.platforms" /> + <_PacksToRemove Include="netstandard.library" /> + + + + + + + <_WorkloadFiles Include="$(DotNetSdkManifestsDirectory)Microsoft.NET.Workload.*/*/WorkloadManifest.*" /> + <_WorkloadDirectoriesToDelete Include="@(_WorkloadFiles->'%(RootDir)%(Directory)'->Distinct())" /> + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Essentials/src/Essentials-net6.csproj b/src/Essentials/src/Essentials-net6.csproj index 5c6e13f9c696..755a7b8ee50f 100644 --- a/src/Essentials/src/Essentials-net6.csproj +++ b/src/Essentials/src/Essentials-net6.csproj @@ -1,7 +1,6 @@ - net6.0;net6.0-ios;net6.0-android - $(TargetFrameworks);net6.0-maccatalyst + net6.0;net6.0-ios;net6.0-android;net6.0-maccatalyst Microsoft.Maui.Essentials Microsoft.Maui.Essentials diff --git a/src/Package/Package-net6.csproj b/src/Package/Package-net6.csproj index baff8353eede..6842c59bd4ff 100644 --- a/src/Package/Package-net6.csproj +++ b/src/Package/Package-net6.csproj @@ -1,8 +1,7 @@ - net6.0;net6.0-android;net6.0-ios - $(TargetFrameworks);net6.0-maccatalyst + net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst Microsoft.Maui Microsoft.Maui.Package enable