Skip to content

[main] Keep using the desktop MSBuild assemblies when building from within Visual Studio. - #25417

Merged
rolfbjarne merged 1 commit into
mainfrom
dev/rolf/backport-pr-25249-main-2026-05-13-v3
May 13, 2026
Merged

rolfbjarne merged 1 commit into
mainfrom
dev/rolf/backport-pr-25249-main-2026-05-13-v3

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented May 13, 2026 •

Copy link
Copy Markdown
Member

Keep using the desktop MSBuild assemblies when building from within Visual
Studio, while we track down why it's not working and fix it for a future release.

Ref: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2968169
Ref: #25418

Backport of #25249.

…ing from within Visual Studio.

Keep using the desktop MSBuild assemblies when building from within Visual
Studio, while we track down why it's not working and fix it for a future
release.

Ref: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2968169
Copilot AI review requested due to automatic review settings May 13, 2026 07:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the iOS SDK MSBuild properties so that when building inside Visual Studio, the build continues to use the desktop-compatible (netstandard2.0) MSBuild task assemblies. This is a temporary compatibility measure while investigating why the newer task assembly path isn’t working correctly in Visual Studio.

Changes:

  • Set _UseDesktopTaskAssemblies=true by default when $(BuildingInsideVisualStudio) is true (unless already overridden).
  • Switch CoreiOSSdkDirectory to point at the netstandard2.0 task directory when _UseDesktopTaskAssemblies is enabled.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #4d83de0] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 4d83de02ba70c47e09be4bbdf839ba5f72ba0165 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #4d83de0] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 4d83de02ba70c47e09be4bbdf839ba5f72ba0165 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 4d83de02ba70c47e09be4bbdf839ba5f72ba0165 [PR build]

@rolfbjarne
rolfbjarne enabled auto-merge (squash) May 13, 2026 08:05
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #4d83de0] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 4d83de02ba70c47e09be4bbdf839ba5f72ba0165 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #4d83de0] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 175 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (iOS): All 16 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 16 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ windows: All 3 tests passed. [attempt 3] Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 4d83de02ba70c47e09be4bbdf839ba5f72ba0165 [PR build]

@rolfbjarne
rolfbjarne merged commit e67eb98 into main May 13, 2026
53 checks passed
rolfbjarne pushed a commit that referenced this pull request Jun 16, 2026
…25662)

## Description

Building a MacCatalyst app inside Visual Studio on Windows ARM64 fails with:

```
error MSB4216: Could not run the "MakeDir" task because MSBuild could not create
or connect to a task host with runtime "NET" and architecture "*".
```

## Root cause

Inside Visual Studio, our MSBuild tasks should run in-process using the `netstandard2.0` assemblies. This is controlled by the `_UseDesktopTaskAssemblies` property. When it is not set, the tasks instead use the `.NET` assemblies, which need a separate .NET task host. That task host does not work reliably from Visual Studio, and fails on Windows ARM64.

#25417 set `_UseDesktopTaskAssemblies` for Visual Studio builds, but only in the iOS SDK. MacCatalyst, macOS and tvOS were missed, so they still try to use the .NET task host and break.

## Fix

Set `_UseDesktopTaskAssemblies` in the shared `Xamarin.Shared.Sdk.props`, which is imported by all four platforms, so the workaround applies everywhere. The iOS SDK keeps setting it earlier (it also needs it for `CoreiOSSdkDirectory`); the `== ''` guard makes the shared copy a no-op for iOS.

Ref: #25418

---------

Co-authored-by: Milos Kotlar 
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rolfbjarne added a commit that referenced this pull request Jun 18, 2026
… for all platforms (#25718)

## Description

Building a MacCatalyst app inside Visual Studio on Windows ARM64 fails
with:

```
error MSB4216: Could not run the "MakeDir" task because MSBuild could not create
or connect to a task host with runtime "NET" and architecture "*".
```

## Root cause

Inside Visual Studio, our MSBuild tasks should run in-process using the
`netstandard2.0` assemblies. This is controlled by the
`_UseDesktopTaskAssemblies` property. When it is not set, the tasks
instead use the `.NET` assemblies, which need a separate .NET task host.
That task host does not work reliably from Visual Studio, and fails on
Windows ARM64.

#25417 set `_UseDesktopTaskAssemblies` for Visual Studio builds, but
only in the iOS SDK. MacCatalyst, macOS and tvOS were missed, so they
still try to use the .NET task host and break.

## Fix

Set `_UseDesktopTaskAssemblies` in the shared
`Xamarin.Shared.Sdk.props`, which is imported by all four platforms, so
the workaround applies everywhere. The iOS SDK keeps setting it earlier
(it also needs it for `CoreiOSSdkDirectory`); the `== ''` guard makes
the shared copy a no-op for iOS.

Ref: #25418

---------

Co-authored-by: Milos Kotlar 
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Backport of #25662.

Co-authored-by: Milos Kotlar 
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants