diff --git a/.vsts-ci.yml b/.vsts-ci.yml index abfd68fda..eb2acb8c9 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -20,6 +20,8 @@ variables: - name: PostBuildSign value: true - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - name: Codeql.Enabled + value: true - group: DotNet-DotNetCli-Storage - group: DotNet-Installer-SDLValidation-Params - name: _PublishUsingPipelines diff --git a/Directory.Build.props b/Directory.Build.props index b87eeccca..2b9d318a6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,7 +9,7 @@ $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) - $(BuildArchitecture) + $(BuildArchitecture) $(BuildArchitecture) $(BuildArchitecture) x64 diff --git a/Native.sln b/Native.sln index 7ce79b609..29bd74903 100644 --- a/Native.sln +++ b/Native.sln @@ -12,9 +12,11 @@ Global Debug|x86 = Debug|x86 Debug|x64 = Debug|x64 Debug|arm64 = Debug|arm64 + Debug|arm = Debug|arm Release|x86 = Release|x86 Release|x64 = Release|x64 Release|arm64 = Release|arm64 + Release|arm = Release|arm EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x86.ActiveCfg = Debug|x86 @@ -23,12 +25,16 @@ Global {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|x64.Build.0 = Debug|x64 {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm64.ActiveCfg = Debug|arm64 {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm64.Build.0 = Debug|arm64 + {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm.ActiveCfg = Debug|arm + {688E2883-C5A9-4D66-A207-772C9160989C}.Debug|arm.Build.0 = Debug|arm {688E2883-C5A9-4D66-A207-772C9160989C}.Release|x86.ActiveCfg = Release|x86 {688E2883-C5A9-4D66-A207-772C9160989C}.Release|x86.Build.0 = Release|x86 {688E2883-C5A9-4D66-A207-772C9160989C}.Release|x64.ActiveCfg = Release|x64 {688E2883-C5A9-4D66-A207-772C9160989C}.Release|x64.Build.0 = Release|x64 {688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm64.ActiveCfg = Release|arm64 {688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm64.Build.0 = Release|arm64 + {688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm.ActiveCfg = Release|arm + {688E2883-C5A9-4D66-A207-772C9160989C}.Release|arm.Build.0 = Release|arm EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NuGet.config b/NuGet.config index 09e307a27..996fccde3 100644 --- a/NuGet.config +++ b/NuGet.config @@ -39,6 +39,8 @@ + + diff --git a/README.md b/README.md index 686aa0dd7..808010978 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ Please see the [dotnet/source-build](https://github.com/dotnet/source-build) rep ## Support -.NET Source-Build is supported on the oldest available .NET SDK feature update, and on Linux only. -For example, if both .NET 6.0.1XX and 6.0.2XX feature updates are available from [dotnet.microsoft.com](https://dotnet.microsoft.com/en-us/download/dotnet/6.0), Source-Build will only support 6.0.1XX. +.NET Source-Build is supported on the oldest available .NET SDK feature update for each major release, and on Linux only. +For example, if .NET 6.0.1xx, 6.0.2xx, and 7.0.1xx feature updates are available from [dotnet.microsoft.com](https://dotnet.microsoft.com/en-us/download/dotnet/6.0), Source-Build will support 6.0.1xx and 7.0.1xx. For the latest information about Source-Build support for new .NET versions, please check our [GitHub Discussions page](https://github.com/dotnet/source-build/discussions) for announcements. ## Prerequisites @@ -79,7 +79,7 @@ The dependencies for building .NET from source can be found [here](https://githu ``` This builds the entire .NET SDK from source. - The resulting SDK is placed at `artifacts/x64/Release/dotnet-sdk-6.0.100-fedora.33-x64.tar.gz`. + The resulting SDK is placed at `artifacts/x64/Release/dotnet-sdk-7.0.100-your-RID.tar.gz`. Optionally add the `--online` flag to add online NuGet restore sources to the build. This is useful for testing unsupported releases that don't yet build without downloading pre-built binaries from the internet. @@ -90,7 +90,7 @@ The dependencies for building .NET from source can be found [here](https://githu ```bash mkdir -p $HOME/dotnet - tar zxf artifacts/x64/Release/dotnet-sdk-6.0.100-fedora.33-x64.tar.gz -C $HOME/dotnet + tar zxf artifacts/x64/Release/dotnet-sdk-7.0.100-your-RID.tar.gz -C $HOME/dotnet ln -s $HOME/dotnet/dotnet /usr/bin/dotnet ``` diff --git a/eng/Build.props b/eng/Build.props index 4df683bab..874132e36 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -1,7 +1,7 @@ - diff --git a/eng/Signing.props b/eng/Signing.props index 3a2373f9e..0d49f78d1 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -7,12 +7,9 @@ - - - - - - + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index aa94ca744..64318f153 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -202,9 +202,9 @@ https://github.com/dotnet/arcade f36ea231c234560514ede4c2747897a737ced28f - + https://github.com/dotnet/source-build-reference-packages - 29cef6e67cbd7989db409037f0c1fe0af21384ad + 4f5672e90b7f908d96aad61a40b0e9b352518b1c diff --git a/eng/Versions.props b/eng/Versions.props index 31985605f..ac9d349c0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ $(VersionMajor).$(VersionMinor) $(MajorMinorVersion).$(VersionSDKMinor) - false + true release @@ -193,17 +193,17 @@ or minor release, prebuilts may be needed. When the release is mature, prebuilts are not necessary, and this property is removed from the file. --> - 7.0.100-rc.2 + 7.0.100 - 7.0.100-rc.1 - 7.0.0-rc.1.6430 - 33.0.0-rc.1.136 - 15.4.1006-rc.1 - 15.4.1006-rc.1 - 12.3.1006-rc.1 - 15.4.1006-rc.1 + 7.0.100 + 7.0.49 + 33.0.4 + 16.0.1478 + 15.4.2372 + 12.3.2372 + 16.0.1478 $(MicrosoftNETCoreAppRefPackageVersion) 7.0.0 7.0.0 diff --git a/eng/source-build-tarball-build-official.yml b/eng/source-build-tarball-build-official.yml index a230a4d7c..5d396baab 100644 --- a/eng/source-build-tarball-build-official.yml +++ b/eng/source-build-tarball-build-official.yml @@ -4,7 +4,19 @@ resources: pipelines: - pipeline: installer-build-resource source: dotnet-installer-official-ci - trigger: true + trigger: + branches: + include: + - main + - release/* + - internal/release/* + exclude: + - release/6.0.3xx + - internal/release/6.0.3xx + - release/6.0.4xx + - internal/release/6.0.4xx + stages: + - build stages: - stage: build diff --git a/src/SourceBuild/Arcade/eng/common/templates/job/source-build-create-tarball.yml b/src/SourceBuild/Arcade/eng/common/templates/job/source-build-create-tarball.yml index cffdf6bdb..ac6d73016 100644 --- a/src/SourceBuild/Arcade/eng/common/templates/job/source-build-create-tarball.yml +++ b/src/SourceBuild/Arcade/eng/common/templates/job/source-build-create-tarball.yml @@ -6,11 +6,20 @@ jobs: displayName: Source-Build Create Tarball pool: ${{ if eq(variables['System.TeamProject'], 'public') }}: - name: NetCore-Svc-Public - demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open + ${{ if in(variables['Build.Reason'], 'PullRequest') }}: + name: NetCore-Public-XL + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open + ${{ else }}: + name: NetCore-Svc-Public + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open ${{ if eq(variables['System.TeamProject'], 'internal') }}: - name: NetCore1ESPool-Svc-Internal - demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 + ${{ if in(variables['Build.Reason'], 'PullRequest') }}: + name: NetCore1ESPool-Internal-XL + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 + ${{ else }}: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 + variables: - name: _BuildConfig value: Release diff --git a/src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml b/src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml index 60b39b652..06bfd2b15 100644 --- a/src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml +++ b/src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml @@ -17,10 +17,13 @@ parameters: poolInternalAmd64: name: NetCore1ESPool-Svc-Internal demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 + poolInternalAmd64PR: + name: NetCore1ESPool-Internal-XL + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 poolInternalArm64: name: Docker-Linux-Arm-Internal poolPublicAmd64: - name: NetCore-Svc-Public + name: NetCore-Public-XL demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open jobs: @@ -68,24 +71,24 @@ jobs: ${{ if eq(variables['System.TeamProject'], 'public') }}: ${{ parameters.poolPublicAmd64 }} ${{ if eq(variables['System.TeamProject'], 'internal') }}: - ${{ parameters.poolInternalAmd64 }} + ${{ if in(variables['Build.Reason'], 'PullRequest') }}: + ${{ parameters.poolInternalAmd64PR }} + ${{ else }}: + ${{ parameters.poolInternalAmd64 }} -- ${{ if eq(variables['System.TeamProject'], 'internal') }}: +- ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}: - template: /src/SourceBuild/Arcade/eng/common/templates/job/source-build-build-tarball.yml parameters: architecture: arm64 dependsOn: ${{ parameters.dependsOn }} - ${{ if in(variables['Build.Reason'], 'PullRequest') }}: - excludeSdkContentTests: true installerBuildResourceId: ${{ parameters.installerBuildResourceId }} matrix: - ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: - Debian11-Offline: - _BootstrapPrep: true - _Container: ${{ parameters.debian11Arm64Container }} - _EnablePoison: false - _ExcludeOmniSharpTests: false - _RunOnline: false + Debian11-Offline: + _BootstrapPrep: true + _Container: ${{ parameters.debian11Arm64Container }} + _EnablePoison: false + _ExcludeOmniSharpTests: false + _RunOnline: false name: Build_Tarball_arm64 pool: ${{ parameters.poolInternalArm64 }} diff --git a/src/SourceBuild/tarball/content/Directory.Build.props b/src/SourceBuild/tarball/content/Directory.Build.props index 860785575..3ffe8c56a 100644 --- a/src/SourceBuild/tarball/content/Directory.Build.props +++ b/src/SourceBuild/tarball/content/Directory.Build.props @@ -17,7 +17,7 @@ $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) - $(BuildArchitecture) + $(BuildArchitecture) $(BuildArchitecture) $(BuildArchitecture) x64 diff --git a/src/SourceBuild/tarball/content/global.json b/src/SourceBuild/tarball/content/global.json index 8d9568376..1bf480e4e 100644 --- a/src/SourceBuild/tarball/content/global.json +++ b/src/SourceBuild/tarball/content/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "7.0.100-rc.2.22477.23" + "dotnet": "7.0.100" }, "msbuild-sdks": { "Microsoft.Build.CentralPackageVersions": "2.0.1", diff --git a/src/SourceBuild/tarball/content/repos/aspnetcore.proj b/src/SourceBuild/tarball/content/repos/aspnetcore.proj index a779e9213..c11f22f5c 100644 --- a/src/SourceBuild/tarball/content/repos/aspnetcore.proj +++ b/src/SourceBuild/tarball/content/repos/aspnetcore.proj @@ -21,6 +21,11 @@ $(ProjectDirectory)global.json $(ProjectDirectory)NuGet.config + + + CS0618 diff --git a/src/SourceBuild/tarball/content/repos/known-good.proj b/src/SourceBuild/tarball/content/repos/known-good.proj index 50720cc4c..6f96a2fdf 100644 --- a/src/SourceBuild/tarball/content/repos/known-good.proj +++ b/src/SourceBuild/tarball/content/repos/known-good.proj @@ -18,7 +18,8 @@ - + + diff --git a/src/SourceBuild/tarball/content/repos/razor-compiler.proj b/src/SourceBuild/tarball/content/repos/razor-compiler.proj index f47d22c98..a56aa1ea4 100644 --- a/src/SourceBuild/tarball/content/repos/razor-compiler.proj +++ b/src/SourceBuild/tarball/content/repos/razor-compiler.proj @@ -7,6 +7,10 @@ $(ProjectDirectory)global.json $(ProjectDirectory)NuGet.config false + + + NU1507 diff --git a/src/SourceBuild/tarball/content/repos/runtime.common.props b/src/SourceBuild/tarball/content/repos/runtime.common.props index 3269a3f63..cb02932f9 100644 --- a/src/SourceBuild/tarball/content/repos/runtime.common.props +++ b/src/SourceBuild/tarball/content/repos/runtime.common.props @@ -13,7 +13,7 @@ $(StandardSourceBuildArgs.Replace('-bl', '-nobl')) $(StandardSourceBuildCommand) $(BuildCommandArgs) - $(ArmEnvironmentVariables) $(StandardSourceBuildCommand) $(BuildCommandArgs) + $(ArmEnvironmentVariables) $(StandardSourceBuildCommand) $(BuildCommandArgs) $(ProjectDirectory)/clean$(ShellExtension) diff --git a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs index ae5508aa4..921ab1f97 100644 --- a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs +++ b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs @@ -96,7 +96,7 @@ internal class DotNetHelper } } - public void ExecuteCmd(string args, string? workingDirectory = null, Action? additionalProcessConfigCallback = null, int expectedExitCode = 0, int millisecondTimeout = -1) + public void ExecuteCmd(string args, string? workingDirectory = null, Action? additionalProcessConfigCallback = null, int? expectedExitCode = 0, int millisecondTimeout = -1) { (Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess( DotNetPath, @@ -105,7 +105,9 @@ internal class DotNetHelper configure: (process) => configureProcess(process, workingDirectory), millisecondTimeout: millisecondTimeout); - ExecuteHelper.ValidateExitCode(executeResult, expectedExitCode); + if (expectedExitCode != null) { + ExecuteHelper.ValidateExitCode(executeResult, (int) expectedExitCode); + } void configureProcess(Process process, string? workingDirectory) { diff --git a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs index f2dc2a75b..4c5a9c425 100644 --- a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs +++ b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs @@ -13,20 +13,18 @@ public class DotNetWatchTests : SmokeTests { public DotNetWatchTests(ITestOutputHelper outputHelper) : base(outputHelper) { } - // TODO: Re-enable https://github.com/dotnet/source-build/issues/2961 - // [Fact] + //[Fact] - Renable with https://github.com/dotnet/source-build/issues/3123 public void WatchTests() { string projectDirectory = DotNetHelper.ExecuteNew(DotNetTemplate.Console.GetName(), nameof(DotNetWatchTests)); bool outputChanged = false; - // We expect an exit code of 143 (128 + 15, i.e. SIGTERM) because we are killing the process manually DotNetHelper.ExecuteCmd( "watch run", workingDirectory: projectDirectory, additionalProcessConfigCallback: processConfigCallback, - expectedExitCode: 143, - millisecondTimeout: 30000); + expectedExitCode: null, // The exit code does not reflect whether or not dotnet watch is working properly + millisecondTimeout: 60000); Assert.True(outputChanged); @@ -53,7 +51,7 @@ public class DotNetWatchTests : SmokeTests { outputChanged = true; OutputHelper.WriteLine("Successfully re-ran program after code change."); - ExecuteHelper.ExecuteProcessValidateExitCode("kill", $"-s TERM {process.Id}", OutputHelper); + process.Kill(true); } }); } diff --git a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/ExecuteHelper.cs b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/ExecuteHelper.cs index 62e1eb594..dbaaa8a80 100644 --- a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/ExecuteHelper.cs +++ b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/ExecuteHelper.cs @@ -70,7 +70,7 @@ internal static class ExecuteHelper if (!process.HasExited) { - outputHelper.WriteLine($"Killing: {fileName} {args}"); + outputHelper.WriteLine($"Process did not exit. Killing {fileName} {args} after waiting {millisecondTimeout} milliseconds."); process.Kill(true); process.WaitForExit(); } diff --git a/src/SourceBuild/tarball/content/tools-local/init-build.proj b/src/SourceBuild/tarball/content/tools-local/init-build.proj index 701f76c0c..b2c3beed1 100644 --- a/src/SourceBuild/tarball/content/tools-local/init-build.proj +++ b/src/SourceBuild/tarball/content/tools-local/init-build.proj @@ -138,7 +138,7 @@ - + diff --git a/src/SourceBuild/tarball/patches/aspnetcore/0001-Disable-warning-CS0618.patch b/src/SourceBuild/tarball/patches/aspnetcore/0001-Disable-warning-CS0618.patch deleted file mode 100644 index c2e2eedf7..000000000 --- a/src/SourceBuild/tarball/patches/aspnetcore/0001-Disable-warning-CS0618.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Logan Bussell -Date: Thu, 12 May 2022 14:32:59 -0700 -Subject: [PATCH] Disable warning CS0618 - -This is needed because IOperation.Children is deprecated in -Microsoft.CodeAnalysis 4.3.0, but aspnetcore references version 4.2.0. - -Requires https://github.com/dotnet/source-build/issues/2482 in order to eliminate this patch ---- - .../src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj b/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj -index 0b94ad2a8f..1b5cb9d907 100644 ---- a/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj -+++ b/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj -@@ -9,6 +9,7 @@ - false - false - $(MSBuildProjectName).nuspec -+ $(NoWarn);CS0618 - - - diff --git a/src/SourceBuild/tarball/patches/aspnetcore/0001-ResolvePackageFileConflicts-workaround.patch b/src/SourceBuild/tarball/patches/aspnetcore/0001-ResolvePackageFileConflicts-workaround.patch new file mode 100644 index 000000000..ab355630e --- /dev/null +++ b/src/SourceBuild/tarball/patches/aspnetcore/0001-ResolvePackageFileConflicts-workaround.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MichaelSimons +Date: Fri, 11 Nov 2022 21:10:54 +0000 +Subject: [PATCH] ResolvePackageFileConflicts workaround + +--- + .../App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj b/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj +index 3b5d2ae950..f92fb421fe 100644 +--- a/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj ++++ b/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj +@@ -253,6 +253,9 @@ This package is an internal implementation of the .NET Core SDK and is not meant + + + ++ ++ ++ + + + diff --git a/src/SourceBuild/tarball/patches/razor-compiler/0001-Add-NoWarn-for-NU1507.patch b/src/SourceBuild/tarball/patches/razor-compiler/0001-Add-NoWarn-for-NU1507.patch deleted file mode 100644 index d1d297915..000000000 --- a/src/SourceBuild/tarball/patches/razor-compiler/0001-Add-NoWarn-for-NU1507.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Logan Bussell -Date: Fri, 13 May 2022 16:14:14 -0700 -Subject: [PATCH] Add NoWarn for NU1507 - -This warning occurs when using NuGet central package management without defining -any Package Source Mappings. - -Workaround for: https://github.com/dotnet/razor-compiler/issues/242 ---- - Directory.Build.props | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Directory.Build.props b/Directory.Build.props -index a57125f5..019ac376 100644 ---- a/Directory.Build.props -+++ b/Directory.Build.props -@@ -55,6 +55,7 @@ - - $(NoWarn.Replace('1591', '')) - $(NoWarn);0105 -+ $(NoWarn);NU1507 - - - $(WarningsNotAsErrors);CS1591 diff --git a/src/finalizer/finalizer.cpp b/src/finalizer/finalizer.cpp index c8f5eca6b..d68418b9b 100644 --- a/src/finalizer/finalizer.cpp +++ b/src/finalizer/finalizer.cpp @@ -447,7 +447,17 @@ extern "C" HRESULT DetectSdk(LPWSTR sczSdkFeatureBandVersion, LPWSTR sczArchitec LogStringLine(REPORT_STANDARD, "Scanning %ls", sczInstalledSdkVersionsKeyName); hr = RegOpen(HKEY_LOCAL_MACHINE, sczInstalledSdkVersionsKeyName, KEY_READ, &hkInstalledSdkVersionsKey); - ExitOnFailure(hr, "Failed to read installed versions key."); + + // When the last SDK is removed the registry key should no longer exist so we can just exit + if (E_FILENOTFOUND == hr) + { + LogStringLine(REPORT_STANDARD, "Registry key not found: %ls.", sczInstalledSdkVersionsKeyName); + hr = S_OK; + *pbInstalled = FALSE; + goto LExit; + } + + ExitOnFailure(hr, "Failed to open registry key: %ls.", sczInstalledSdkVersionsKeyName); for (DWORD dwSdkVersionsValueIndex = 0;; ++dwSdkVersionsValueIndex) { @@ -509,9 +519,10 @@ int wmain(int argc, wchar_t* argv[]) hr = ::DetectSdk(sczFeatureBandVersion, argv[3], &bSdkFeatureBandInstalled); ExitOnFailure(hr, "Failed to detect installed SDKs."); - if (!bSdkFeatureBandInstalled) + // If the feature band is still present, do not remove workloads. + if (bSdkFeatureBandInstalled) { - LogStringLine(REPORT_STANDARD, "SDK with feature band %ls could not be found.", sczFeatureBandVersion); + LogStringLine(REPORT_STANDARD, "Detected SDK with feature band %ls.", sczFeatureBandVersion); goto LExit; } diff --git a/src/redist/targets/Crossgen.targets b/src/redist/targets/Crossgen.targets index da7d186a1..399529689 100644 --- a/src/redist/targets/Crossgen.targets +++ b/src/redist/targets/Crossgen.targets @@ -29,7 +29,27 @@ BuildInParallel="False" Projects="@(CrossGenDownloadPackageProject)"> - + + + + net7.0 + + $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk\tools\$(DefaultToolTfm)\ + $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\tools\$(DefaultToolTfm)\ + $(SdkOutputDirectory)Sdks\NuGet.Build.Tasks.Pack\CoreCLR\ + $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Razor\tasks\$(DefaultToolTfm)\ + $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.WindowsDesktop\tools\$(DefaultToolTfm)\ + $(SdkOutputDirectory)Sdks\Microsoft.NET.ILLink.Tasks\tools\$(DefaultToolTfm)\ + $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Publish\tools\$(DefaultToolTfm)\ + $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Web\tools\$(DefaultToolTfm)\ + $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Web.ProjectSystem\tools\$(DefaultToolTfm)\ + $(SdkOutputDirectory)Sdks\Microsoft.NET.Sdk.Worker\tools\$(DefaultToolTfm)\ + + @@ -49,16 +69,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -121,6 +141,21 @@ false + + + + + + + + + + + + + + + 30 - $([MSBuild]::Add($(VersionFeature), 30)) + 32 17 $([MSBuild]::Add($(VersionFeature), 10)) diff --git a/src/redist/targets/packaging/deb/postinst b/src/redist/targets/packaging/deb/postinst index 615c17e6b..696ec8acc 100644 --- a/src/redist/targets/packaging/deb/postinst +++ b/src/redist/targets/packaging/deb/postinst @@ -4,6 +4,5 @@ first_run() { /usr/share/dotnet/dotnet exec /usr/share/dotnet/sdk/%SDK_VERSION%/dotnet.dll internal-reportinstallsuccess "debianpackage" > /dev/null 2>&1 || true } -INSTALL_TEMP_HOME=/tmp/dotnet-installer -[ -d $INSTALL_TEMP_HOME ] || mkdir $INSTALL_TEMP_HOME +INSTALL_TEMP_HOME=$(mktemp -d) # mktemp should set 700 perm automatically HOME=$INSTALL_TEMP_HOME first_run diff --git a/src/redist/targets/packaging/osx/clisdk/scripts/postinstall b/src/redist/targets/packaging/osx/clisdk/scripts/postinstall index 28339be99..86710223d 100644 --- a/src/redist/targets/packaging/osx/clisdk/scripts/postinstall +++ b/src/redist/targets/packaging/osx/clisdk/scripts/postinstall @@ -12,7 +12,7 @@ first_run() { $INSTALL_DESTINATION/dotnet exec $INSTALL_DESTINATION/sdk/%SDK_VERSION%/dotnet.dll internal-reportinstallsuccess "$1" > /dev/null 2>&1 || true } -[ -d $INSTALL_TEMP_HOME ] || mkdir $INSTALL_TEMP_HOME +INSTALL_TEMP_HOME=$(mktemp -d) # mktemp should set 700 perm automatically HOME=$INSTALL_TEMP_HOME first_run exit 0 diff --git a/src/redist/targets/packaging/windows/clisdk/bundle.wxs b/src/redist/targets/packaging/windows/clisdk/bundle.wxs index 346e66d75..bac843303 100644 --- a/src/redist/targets/packaging/windows/clisdk/bundle.wxs +++ b/src/redist/targets/packaging/windows/clisdk/bundle.wxs @@ -151,7 +151,31 @@ - + + + + + @@ -208,20 +232,7 @@ - - + diff --git a/test/EndToEnd/TelemetryOptOutDefaultTests.cs b/test/EndToEnd/TelemetryOptOutDefaultTests.cs new file mode 100644 index 000000000..1e2d2ecef --- /dev/null +++ b/test/EndToEnd/TelemetryOptOutDefaultTests.cs @@ -0,0 +1,24 @@ +using System.IO; +using FluentAssertions; +using Microsoft.DotNet.Tools.Test.Utilities; +using Xunit; + +namespace EndToEnd.Tests +{ + public class TelemetryOptOutDefault : TestBase + { + [Fact] + public void TelemetryOptOutDefaultAttribute() + { + var versionCommand = new DotnetCommand() + .ExecuteWithCapturedOutput("--version"); + + var sdkVersion = versionCommand.StdOut.Trim(); + + var dotnetdir = Path.Combine(Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest), "sdk", sdkVersion); + + var result = AssemblyInfo.Get(Path.Combine(dotnetdir, "dotnet.dll"), "AssemblyMetadataAttribute"); + result.Should().Contain("TelemetryOptOutDefault:False"); + } + } +} diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/AssemblyInfo.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/AssemblyInfo.cs new file mode 100644 index 000000000..f02cfbeb3 --- /dev/null +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/AssemblyInfo.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection.Metadata; +using System.Reflection.PortableExecutable; +using System.Text; + +namespace Microsoft.DotNet.Tools.Test.Utilities +{ + public static class AssemblyInfo + { + public static IList Get(string assemblyPath, string assemblyInfoName) + { + var list = new List(); + + using (var stream = File.OpenRead(assemblyPath)) + using (var peReader = new PEReader(stream)) + { + var metadataReader = peReader.GetMetadataReader(); + var assemblyDefinition = metadataReader.GetAssemblyDefinition(); + + foreach (var handle in assemblyDefinition.GetCustomAttributes()) + { + var attribute = metadataReader.GetCustomAttribute(handle); + var constructor = metadataReader.GetMemberReference((MemberReferenceHandle)attribute.Constructor); + var type = metadataReader.GetTypeReference((TypeReferenceHandle)constructor.Parent); + var name = metadataReader.GetString(type.Name); + + if (name.Equals(assemblyInfoName)) + { + var signature = metadataReader.GetBlobReader(constructor.Signature); + var value = metadataReader.GetBlobReader(attribute.Value); + var header = signature.ReadSignatureHeader(); + + const ushort prolog = 1; // two-byte "prolog" defined by ECMA-335 (II.23.3) to be at the beginning of attribute value blobs + if (value.ReadUInt16() != prolog || header.Kind != SignatureKind.Method || header.IsGeneric) + { + throw new BadImageFormatException(); + } + + var paramCount = signature.ReadCompressedInteger(); + if (paramCount <= 0 || // must have at least 1 parameter + signature.ReadSignatureTypeCode() != SignatureTypeCode.Void) // return type must be void + { + continue; + } + + var sb = new StringBuilder(); + while (paramCount > 0 && sb != null) + { + switch (signature.ReadSignatureTypeCode()) + { + case SignatureTypeCode.String: + sb.Append(value.ReadSerializedString()); + break; + default: + sb = null; + break; + } + + paramCount--; + if (paramCount != 0) + { + sb?.Append(':'); + } + } + + if (sb != null) + { + list.Add(sb.ToString()); + } + } + } + } + return list; + } + } +}