From e79b111f70a7742d3ad871ca8ca7132a7e139538 Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Sun, 14 Sep 2025 10:04:19 +0200 Subject: [PATCH 1/5] Create Roslyn apphosts --- eng/Signing.props | 3 +++ eng/Version.Details.props | 22 +++++++++---------- src/Layout/Directory.Build.props | 6 +++++ src/Layout/redist/targets/Crossgen.targets | 1 + .../redist/targets/GenerateLayout.targets | 7 ++++++ .../RoslynBuildTaskTests.cs | 17 +++++++------- 6 files changed, 37 insertions(+), 19 deletions(-) diff --git a/eng/Signing.props b/eng/Signing.props index 484697efecbc..872602d12f5c 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -84,6 +84,9 @@ + + + diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 830f13ac3d87..53684be0cfd3 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -35,16 +35,16 @@ This file should be imported by eng/Versions.props 17.15.0-preview-25427-104 7.0.0-preview.1.42804 10.0.0-beta.25427.104 - 5.0.0-2.25427.104 - 5.0.0-2.25427.104 - 5.0.0-2.25427.104 - 5.0.0-2.25427.104 - 5.0.0-2.25427.104 - 5.0.0-2.25427.104 - 5.0.0-2.25427.104 + 5.0.0-2.25453.8 + 5.0.0-2.25453.8 + 5.0.0-2.25453.8 + 5.0.0-2.25453.8 + 5.0.0-2.25453.8 + 5.0.0-2.25453.8 + 5.0.0-2.25453.8 10.0.0-preview.25427.104 - 5.0.0-2.25427.104 - 5.0.0-2.25427.104 + 5.0.0-2.25453.8 + 5.0.0-2.25453.8 2.0.0-preview.1.25427.104 2.2.0-beta.25427.104 10.0.0-beta.25427.104 @@ -68,8 +68,8 @@ This file should be imported by eng/Versions.props 10.0.0-rc.2.25427.104 14.0.100-rc2.25427.104 10.0.0-rc.2.25427.104 - 5.0.0-2.25427.104 - 5.0.0-2.25427.104 + 5.0.0-2.25453.8 + 5.0.0-2.25453.8 10.0.0-rc.2.25427.104 10.0.0-rc.2.25427.104 10.0.0-rc.2.25427.104 diff --git a/src/Layout/Directory.Build.props b/src/Layout/Directory.Build.props index 479a7c0a421e..c8bc9ffafc2a 100644 --- a/src/Layout/Directory.Build.props +++ b/src/Layout/Directory.Build.props @@ -78,4 +78,10 @@ $(MSBuildThisFileDirectory)pkg\ + + <_RoslynAppHost Include="$(OutputPath)Roslyn\bincore\csc.dll" /> + <_RoslynAppHost Include="$(OutputPath)Roslyn\bincore\vbc.dll" /> + <_RoslynAppHost Include="$(OutputPath)Roslyn\bincore\VBCSCompiler.dll" /> + + diff --git a/src/Layout/redist/targets/Crossgen.targets b/src/Layout/redist/targets/Crossgen.targets index e9a22ddb4f8f..7edf479acaa5 100644 --- a/src/Layout/redist/targets/Crossgen.targets +++ b/src/Layout/redist/targets/Crossgen.targets @@ -200,6 +200,7 @@ + diff --git a/src/Layout/redist/targets/GenerateLayout.targets b/src/Layout/redist/targets/GenerateLayout.targets index 65d4aff197c6..c3731494df6c 100644 --- a/src/Layout/redist/targets/GenerateLayout.targets +++ b/src/Layout/redist/targets/GenerateLayout.targets @@ -59,6 +59,12 @@ + + @@ -495,6 +501,7 @@ + diff --git a/test/Microsoft.NET.Build.Tests/RoslynBuildTaskTests.cs b/test/Microsoft.NET.Build.Tests/RoslynBuildTaskTests.cs index ba14cd54eebc..2f473b12d72f 100644 --- a/test/Microsoft.NET.Build.Tests/RoslynBuildTaskTests.cs +++ b/test/Microsoft.NET.Build.Tests/RoslynBuildTaskTests.cs @@ -6,6 +6,7 @@ using Basic.CompilerLog.Util; using Microsoft.Build.Logging.StructuredLogger; using Microsoft.CodeAnalysis; +using Microsoft.DotNet.Cli.Utils; namespace Microsoft.NET.Build.Tests; @@ -18,16 +19,16 @@ public sealed class RoslynBuildTaskTests(ITestOutputHelper log) : SdkTest(log) _ => throw new ArgumentOutOfRangeException(paramName: nameof(language)), }; - private static string CoreCompilerFileName(Language language) => CompilerFileNameWithoutExtension(language) + ".dll"; + private static string DotNetExecCompilerFileName(Language language) => CompilerFileNameWithoutExtension(language) + ".dll"; - private static string FxCompilerFileName(Language language) => CompilerFileNameWithoutExtension(language) + ".exe"; + private static string AppHostCompilerFileName(Language language) => CompilerFileNameWithoutExtension(language) + FileNameSuffixes.CurrentPlatform.Exe; [FullMSBuildOnlyTheory, CombinatorialData] public void FullMSBuild_SdkStyle(bool useSharedCompilation, Language language) { var testAsset = CreateProject(useSharedCompilation, language); var buildCommand = BuildAndRunUsingMSBuild(testAsset); - VerifyCompiler(buildCommand, CoreCompilerFileName(language), useSharedCompilation); + VerifyCompiler(buildCommand, AppHostCompilerFileName(language), useSharedCompilation); } [FullMSBuildOnlyTheory, CombinatorialData] @@ -38,7 +39,7 @@ public void FullMSBuild_SdkStyle_OptOut(bool useSharedCompilation, Language lang doc.Root!.Element("PropertyGroup")!.Add(new XElement("RoslynCompilerType", "Framework")); }); var buildCommand = BuildAndRunUsingMSBuild(testAsset); - VerifyCompiler(buildCommand, FxCompilerFileName(language), useSharedCompilation); + VerifyCompiler(buildCommand, AppHostCompilerFileName(language), useSharedCompilation); } [FullMSBuildOnlyTheory, CombinatorialData] @@ -50,7 +51,7 @@ public void FullMSBuild_NonSdkStyle(bool useSharedCompilation, Language language project.TargetFrameworkVersion = "v4.7.2"; }); var buildCommand = BuildAndRunUsingMSBuild(testAsset); - VerifyCompiler(buildCommand, FxCompilerFileName(language), useSharedCompilation); + VerifyCompiler(buildCommand, AppHostCompilerFileName(language), useSharedCompilation); } [FullMSBuildOnlyTheory, CombinatorialData] @@ -58,7 +59,7 @@ public void FullMSBuild_SdkStyle_ToolsetPackage(bool useSharedCompilation, Langu { var testAsset = CreateProject(useSharedCompilation, language, AddCompilersToolsetPackage); var buildCommand = BuildAndRunUsingMSBuild(testAsset); - VerifyCompiler(buildCommand, FxCompilerFileName(language), useSharedCompilation, toolsetPackage: true); + VerifyCompiler(buildCommand, AppHostCompilerFileName(language), useSharedCompilation, toolsetPackage: true); } [Theory, CombinatorialData] @@ -66,7 +67,7 @@ public void DotNet(bool useSharedCompilation, Language language) { var testAsset = CreateProject(useSharedCompilation, language); var buildCommand = BuildAndRunUsingDotNet(testAsset); - VerifyCompiler(buildCommand, CoreCompilerFileName(language), useSharedCompilation); + VerifyCompiler(buildCommand, AppHostCompilerFileName(language), useSharedCompilation); } // https://github.com/dotnet/sdk/issues/49665 @@ -75,7 +76,7 @@ public void DotNet_ToolsetPackage(bool useSharedCompilation, Language language) { var testAsset = CreateProject(useSharedCompilation, language, AddCompilersToolsetPackage); var buildCommand = BuildAndRunUsingDotNet(testAsset); - VerifyCompiler(buildCommand, CoreCompilerFileName(language), useSharedCompilation, toolsetPackage: true); + VerifyCompiler(buildCommand, DotNetExecCompilerFileName(language), useSharedCompilation, toolsetPackage: true); } private TestAsset CreateProject(bool useSharedCompilation, Language language, Action? configure = null, [CallerMemberName] string callingMethod = "") From 83234155858e4f616cc23bc228c74f89e31b4fee Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Sun, 14 Sep 2025 11:29:20 +0200 Subject: [PATCH 2/5] Update Roslyn --- eng/Version.Details.props | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 53684be0cfd3..4c249a6c4e98 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -35,16 +35,16 @@ This file should be imported by eng/Versions.props 17.15.0-preview-25427-104 7.0.0-preview.1.42804 10.0.0-beta.25427.104 - 5.0.0-2.25453.8 - 5.0.0-2.25453.8 - 5.0.0-2.25453.8 - 5.0.0-2.25453.8 - 5.0.0-2.25453.8 - 5.0.0-2.25453.8 - 5.0.0-2.25453.8 + 5.0.0-2.25463.3 + 5.0.0-2.25463.3 + 5.0.0-2.25463.3 + 5.0.0-2.25463.3 + 5.0.0-2.25463.3 + 5.0.0-2.25463.3 + 5.0.0-2.25463.3 10.0.0-preview.25427.104 - 5.0.0-2.25453.8 - 5.0.0-2.25453.8 + 5.0.0-2.25463.3 + 5.0.0-2.25463.3 2.0.0-preview.1.25427.104 2.2.0-beta.25427.104 10.0.0-beta.25427.104 @@ -68,8 +68,8 @@ This file should be imported by eng/Versions.props 10.0.0-rc.2.25427.104 14.0.100-rc2.25427.104 10.0.0-rc.2.25427.104 - 5.0.0-2.25453.8 - 5.0.0-2.25453.8 + 5.0.0-2.25463.3 + 5.0.0-2.25463.3 10.0.0-rc.2.25427.104 10.0.0-rc.2.25427.104 10.0.0-rc.2.25427.104 From 66d693ce08155b48a9f8cf120c88ef4d1a26d484 Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Sun, 14 Sep 2025 11:32:09 +0200 Subject: [PATCH 3/5] Update complog util --- Directory.Packages.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 788923bf48d6..bbe21de6f499 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ $(NoWarn);NU1507 - + @@ -93,7 +93,7 @@ - + From 44d9d029262a14a622f48268819e034aee8a1a09 Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Mon, 15 Sep 2025 11:52:58 +0200 Subject: [PATCH 4/5] Update CSC arguments --- src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.Generated.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.Generated.cs b/src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.Generated.cs index cc0251285124..33c41cf12ef7 100644 --- a/src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.Generated.cs +++ b/src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.Generated.cs @@ -201,7 +201,6 @@ private IEnumerable GetCscArguments( "/deterministic+", "/langversion:14.0", "/features:FileBasedProgram", - $"/analyzerconfig:{SdkPath}/Sdks/Microsoft.NET.Sdk/codestyle/cs/build/config/analysislevelstyle_default.globalconfig", $"/analyzerconfig:{objDir}/{fileNameWithoutExtension}.GeneratedMSBuildEditorConfig.editorconfig", $"/analyzerconfig:{SdkPath}/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_10_default.globalconfig", $"/analyzer:{SdkPath}/Sdks/Microsoft.NET.Sdk/targets/../analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll", From 3c2ef138bde1fa2f79e60f8c48e09013ffe499a5 Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Tue, 16 Sep 2025 09:55:43 +0200 Subject: [PATCH 5/5] Fix macos sign condition --- src/Layout/redist/targets/GenerateLayout.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Layout/redist/targets/GenerateLayout.targets b/src/Layout/redist/targets/GenerateLayout.targets index c3731494df6c..271701199655 100644 --- a/src/Layout/redist/targets/GenerateLayout.targets +++ b/src/Layout/redist/targets/GenerateLayout.targets @@ -64,7 +64,7 @@ AppHostDestinationPath="%(_RoslynAppHost.RootDir)%(_RoslynAppHost.Directory)%(_RoslynAppHost.Filename)$(ExeExtension)" AppBinaryName="%(_RoslynAppHost.Filename)%(_RoslynAppHost.Extension)" IntermediateAssembly="%(_RoslynAppHost.FullPath)" - EnableMacOSCodeSign="$(RuntimeIdentifier.StartsWith('osx'))" /> + EnableMacOSCodeSign="$(TargetRid.StartsWith('osx'))" />