Project names (& paths) containing a valid characters now cause errors on project generation (for iOS or MacCatalyst, and Android)
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Description
Previously valid characters included on the project or solution name are now causing the iOS and MacCatalyst versions of apps to fail to build.
Ok, so the "valid" characters in question are ones you might not expect, but this still leads to weird exception messages.
The valid characters in question are:
- Underscore `_`
- At sign `@`
- Open bracket `(`
- Close bracket `)`
These are all "technically" valid characters in a project name but have started to cause issues with iOS and Mac Catalyst compilation in the latest VS previews. (And, presumably the .net 9 previews too)
When a project is created that includes one of these characters in the project or solution name, the newly generated project immediately reports errors (due to a failed design time compilation.)
These characters did not cause a problem previously.
While the above characters aren't valid in types and namespaces, they are all correctly substituted with underscores in code files.
It's not an issue with the project or solution settings. The problem is the use of these characters inside the file path.
It's possible to create directory that includes one or more of these characters and then create a project in that location that only includes alphanumeric characters but still produces the same errors.
I expect a change has been made with the mac/iOS tooling that doesn't correctly escape file paths.
X-Ref: #23839 and #26486 (similar issues relating to the inclusion of an underscore but only affecting Windows)
For additional reference, I have the following installed:
```ascii
> dotnet --list-sdks
3.1.426 [C:\Program Files\dotnet\sdk]
5.0.104 [C:\Program Files\dotnet\sdk]
5.0.214 [C:\Program Files\dotnet\sdk]
5.0.302 [C:\Program Files\dotnet\sdk]
5.0.303 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
5.0.416 [C:\Program Files\dotnet\sdk]
6.0.202 [C:\Program Files\dotnet\sdk]
6.0.203 [C:\Program Files\dotnet\sdk]
6.0.321 [C:\Program Files\dotnet\sdk]
6.0.401-faulty [C:\Program Files\dotnet\sdk]
6.0.428 [C:\Program Files\dotnet\sdk]
7.0.317 [C:\Program Files\dotnet\sdk]
9.0.101 [C:\Program Files\dotnet\sdk]
9.0.200-preview.0.24575.35 [C:\Program Files\dotnet\sdk]
```
### Steps to Reproduce
1. Using Visual Studio **Version 17.13.0 Preview 2.0**
2. File > New .NET MAUI App
3. Set Project name to `Maui_@()App`
4. Use .NET 9.0
5. Do NOT include sample content
6. Click "Create"
7. When the project opens in VS, wait a few seconds and then **see errors**:

The Error List includes:
```ascii
Severity Code Description Project File
Error (active) NETSDK1082 There was no runtime pack for Microsoft.NETCore.App available for the specified RuntimeIdentifier 'iossimulator-x64'. Maui_@()App (net9.0-ios) C:\Program Files\dotnet\sdk\9.0.200-preview.0.24575.35\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 495
Error (active) NETSDK1082 There was no runtime pack for Microsoft.NETCore.App available for the specified RuntimeIdentifier 'maccatalyst-x64'. Maui_@()App (net9.0-maccatalyst) C:\Program Files\dotnet\sdk\9.0.200-preview.0.24575.35\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 495
```
**Expected:** the generated project should load without issue.
Note that the Windows version of the generated project will build and run without issue.
The Android version of the project fails to build with **XAPRAS7004**
```ascii
System.ArgumentException: must not be null or empty
Parameter name: abi
at Xamarin.Android.Tasks.ProcessAssemblies.SetAssemblyAbiMetadata(String abi, ITaskItem assembly, ITaskItem symbol) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs:line 103
at Xamarin.Android.Tasks.ProcessAssemblies.SetMetadataForAssemblies(List`1 output, Dictionary`2 symbols) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs:line 128
at Xamarin.Android.Tasks.ProcessAssemblies.RunTask() in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs:line 62
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25
```
_No project repro link included as it happens on new project generation. - I can add one if it will really make a difference._
### Link to public reproduction project repository
_No response_
### Version with bug
9.0.21 SR2.1
### Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
### Last version that worked well
9.0.0 GA
### Affected platforms
macOS, iOS, Android
### Affected platform versions
_No response_
### Did you find any workaround?
The workaround is to not have these characters in the file paths of anything included in the solution.
I assume this will be very low priority but it would be good if the project name validation could be updated when creating a new project and/or if the error messages displayed could better point to the real cause of the issue.
### Relevant log output
```shell
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.