Port Roslyn apphost related changes from release/10.0.1xx to main#3180
Merged
jjonescz merged 6 commits intodotnet:mainfrom Oct 31, 2025
Merged
Port Roslyn apphost related changes from release/10.0.1xx to main#3180jjonescz merged 6 commits intodotnet:mainfrom
jjonescz merged 6 commits intodotnet:mainfrom
Conversation
The build currently fails with: > /Users/runner/work/1/s/src/sdk/artifacts/bin/redist/Release/net10.0/Roslyn/bincore/csc: is already signed Follow-up to dotnet#3052 This makes the codesign command now match what we do in dotnet/runtime: https://github.com/dotnet/runtime/blob/9bcdd873eb4b93934ae34328845599f63253d32a/eng/native/functions.cmake#L736
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for creating native apphost executables for Roslyn compiler tools (csc, vbc, VBCSCompiler) on macOS and other Unix platforms, with proper code signing and file permission handling. It also improves Unix file mode preservation throughout the signing and packaging infrastructure.
- Creates apphosts for Roslyn compiler tools and applies macOS code signing with entitlements
- Preserves Unix file permissions across archive extraction/repacking operations
- Adds chmod operations to ensure Roslyn apphosts have executable permissions
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sdk/src/Layout/redist/targets/GenerateLayout.targets | Adds CreateAppHost task and macOS code signing for Roslyn tools; sets executable permissions |
| src/sdk/src/Layout/redist/targets/Crossgen.targets | Adds chmod command for Roslyn apphosts in crossgen output directory |
| src/sdk/src/Layout/redist/roslyn-entitlements.plist | New entitlements file for macOS code signing with JIT and debugging permissions |
| src/sdk/src/Layout/Directory.Build.props | Defines _RoslynAppHost items for the three compiler DLLs |
| src/sdk/eng/Signing.props | Adds macOS signing configuration for Roslyn apphost executables |
| src/arcade/src/Microsoft.DotNet.SignTool/src/ZipDataEntry.cs | Adds UnixFileMode property to preserve file permissions |
| src/arcade/src/Microsoft.DotNet.SignTool/src/ZipData.cs | Implements Unix file mode preservation; adds logging; fixes typo |
| src/arcade/src/Microsoft.DotNet.SignTool/src/Configuration.cs | Calls SetUnixFileMode when extracting files |
| src/arcade/src/Microsoft.DotNet.SignTool.Tests/SignToolTests.cs | Updates test calls to include logging parameter |
| src/arcade/src/Microsoft.DotNet.Build.Tasks.Installers/src/CpioEntry.cs | Adds FilePermissionMask constant |
| src/arcade/src/Microsoft.DotNet.Build.Tasks.Installers/src/ArEntry.cs | Adds FilePermissionMask constant |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
akoeplinger
approved these changes
Oct 31, 2025
YuliiaKovalova
added a commit
that referenced
this pull request
Feb 12, 2026
Similar to Roslyn apphost support (PR #3180), adds: - CreateAppHost for MSBuild.dll -> MSBuild.exe/MSBuild native executable - macOS codesign with entitlements plist - chmod 755 for Unix apphost executables - MacDeveloperHarden signing for macOS
YuliiaKovalova
added a commit
that referenced
this pull request
Mar 4, 2026
Adds SDK layout and installer support for the MSBuild apphost, following the same pattern as the Roslyn apphost changes (#3180). Changes: - Define _MSBuildAppHost item in Directory.Build.props - Add CreateMSBuildAppHost target in GenerateLayout.targets (CreateAppHost, COM .tlb copy on Windows, codesign on macOS) - Add MSBuild apphost chmod in ChmodPublishDir and Crossgen targets - Add macOS signing config for MSBuild apphost in Signing.props - Add msbuild-entitlements.plist for macOS codesigning - Add Microsoft.Build.Framework.tlb binary for Windows COM support - Allow .tlb in allowed-vmr-binaries.txt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
YuliiaKovalova
added a commit
that referenced
this pull request
Mar 4, 2026
Adds SDK layout and installer support for the MSBuild apphost, following the same pattern as the Roslyn apphost changes (#3180). Changes: - Define _MSBuildAppHost item in Directory.Build.props - Add CreateMSBuildAppHost target in GenerateLayout.targets (CreateAppHost, COM .tlb copy on Windows, codesign on macOS) - Add MSBuild apphost chmod in ChmodPublishDir and Crossgen targets - Add macOS signing config for MSBuild apphost in Signing.props - Add msbuild-entitlements.plist for macOS codesigning - Add Microsoft.Build.Framework.tlb binary for Windows COM support - Allow .tlb in allowed-vmr-binaries.txt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dotnet-maestro bot
added a commit
that referenced
this pull request
Mar 9, 2026
[main] Source code updates from dotnet/msbuild - Add MSBuild apphost installer changes Adds SDK layout and installer support for the MSBuild apphost, following the same pattern as the Roslyn apphost changes (#3180). Changes: - Define _MSBuildAppHost item in Directory.Build.props - Add CreateMSBuildAppHost target in GenerateLayout.targets (CreateAppHost, COM .tlb copy on Windows, codesign on macOS) - Add MSBuild apphost chmod in ChmodPublishDir and Crossgen targets - Add macOS signing config for MSBuild apphost in Signing.props - Add msbuild-entitlements.plist for macOS codesigning - Add Microsoft.Build.Framework.tlb binary for Windows COM support - Allow .tlb in allowed-vmr-binaries.txt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> - Fix BuildEnvironmentHelper to not use apphost when running via dotnet TryFromMSBuildAppHost and TryFromAppContextBaseDirectory now check IsRunningInMSBuildExe before using the MSBuild apphost as the current MSBuild executable. Without this, worker nodes get launched via the apphost, changing Environment.ProcessPath to the SDK directory where dotnet is not present, breaking Process.Start("dotnet") resolution in tasks like VSTestTask. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> - Generate Microsoft.Build.Framework.tlb at build time instead of checking in binary - Remove checked-in .tlb binary from sdk Layout; generate at build time via tlbexp.exe during net472 build (CreateTypeLib target) - Unified tlbexp.exe resolution: registry-based lookup with hardcoded fallback, works on both desktop and Core MSBuild (no MSBuildRuntimeType branching) - Generate both x86 and x64 type libraries in all builds (the .tlb ships in both Visual Studio and the .NET SDK on Windows) - Enable CreateTlb in VMR Windows builds (DotNetBuildSourceOnly != true) - Include .tlb in Microsoft.Build.Framework NuGet package (lib/net472/) - SDK layout copies .tlb from NuGet package cache with Exists() guard Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> - Fix VSTestTask to use DOTNET_HOST_PATH and revert BuildEnvironmentHelper workaround VSTestTask: Use DOTNET_HOST_PATH environment variable (set by the SDK) to resolve the dotnet host path, with PATH search as fallback. This is the proper fix for the 'dotnet not found' error that occurs when MSBuild runs via the apphost and Environment.ProcessPath changes to the SDK directory. BuildEnvironmentHelper: Revert the IsRunningInMSBuildExe guard in TryFromMSBuildAppHost and the context-aware logic in TryFromAppContextBaseDirectory. These were workarounds for the same issue and are no longer needed now that VSTestTask resolves dotnet properly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dotnet-maestro bot
added a commit
that referenced
this pull request
Mar 9, 2026
[release/10.0.3xx] Source code updates from dotnet/msbuild - Add MSBuild apphost installer changes Adds SDK layout and installer support for the MSBuild apphost, following the same pattern as the Roslyn apphost changes (#3180). Changes: - Define _MSBuildAppHost item in Directory.Build.props - Add CreateMSBuildAppHost target in GenerateLayout.targets (CreateAppHost, COM .tlb copy on Windows, codesign on macOS) - Add MSBuild apphost chmod in ChmodPublishDir and Crossgen targets - Add macOS signing config for MSBuild apphost in Signing.props - Add msbuild-entitlements.plist for macOS codesigning - Add Microsoft.Build.Framework.tlb binary for Windows COM support - Allow .tlb in allowed-vmr-binaries.txt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> - Fix BuildEnvironmentHelper to not use apphost when running via dotnet TryFromMSBuildAppHost and TryFromAppContextBaseDirectory now check IsRunningInMSBuildExe before using the MSBuild apphost as the current MSBuild executable. Without this, worker nodes get launched via the apphost, changing Environment.ProcessPath to the SDK directory where dotnet is not present, breaking Process.Start("dotnet") resolution in tasks like VSTestTask. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> - Add ExcludeAssets warning for msbuild deps in sdk - Generate Microsoft.Build.Framework.tlb at build time instead of checking in binary - Remove checked-in .tlb binary from sdk Layout; generate at build time via tlbexp.exe during net472 build (CreateTypeLib target) - Unified tlbexp.exe resolution: registry-based lookup with hardcoded fallback, works on both desktop and Core MSBuild (no MSBuildRuntimeType branching) - Generate both x86 and x64 type libraries in all builds (the .tlb ships in both Visual Studio and the .NET SDK on Windows) - Enable CreateTlb in VMR Windows builds (DotNetBuildSourceOnly != true) - Include .tlb in Microsoft.Build.Framework NuGet package (lib/net472/) - SDK layout copies .tlb from NuGet package cache with Exists() guard Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> - Fix VSTestTask to use DOTNET_HOST_PATH and revert BuildEnvironmentHelper workaround VSTestTask: Use DOTNET_HOST_PATH environment variable (set by the SDK) to resolve the dotnet host path, with PATH search as fallback. This is the proper fix for the 'dotnet not found' error that occurs when MSBuild runs via the apphost and Environment.ProcessPath changes to the SDK directory. BuildEnvironmentHelper: Revert the IsRunningInMSBuildExe guard in TryFromMSBuildAppHost and the context-aware logic in TryFromAppContextBaseDirectory. These were workarounds for the same issue and are no longer needed now that VSTestTask resolves dotnet properly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean cherry-picks with no conflicts: #2425, #2464, #2491, #3052, #3069