.NET 9 SDK WPF build broken with AssemblyName in Directory.Build.props
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
We have a pretty complex solution with a central `Directory.Build.props` file.
This `Directory.Build.props` file contains - among other stuff - a `RootNamespace` property that sets a default root namespace according to our conventions.
Something similar to this:
```
MyCompanyName.MyProductName.$(MSBuildProjectName)
$(RootNamespace)
```
The goal of this is that our `.csproj` files have short names without a `MyCompanyName.MyProductName.` prefix, but the namespaces and generated assemblies should have this prefix.
This worked since years up to .NET SDK 8.0.403. But it's broken since 2024-11-13 when Visual Studio 17.12 (which brings .NET SDK 9.0.100) was installed. It breaks WPF builds if the `Directory.Build.props` file sets a `RootNamespace` and/or a custom `AssemblyName` MSBuild property. It works if the property is moved to the WPF project's `.csproj` file. But it really needs to be moved, i.e. removed from the central `Directory.Build.props` file.
Something seems to be broken in the WPF XAML compile process.
As a workaround, I would have to comment out the `` property in `Directory.Build.props`, but this would break (or at least change) the output of all our other projects.
### Reproduction Steps
Please see that attached ZIP file for a minimal repro.
Uncomment the `` tag in `Directory.Build.props` and the (clean) build will fail.
[MyWpfApp.zip](https://github.com/user-attachments/files/17737199/MyWpfApp.zip)
### Expected behavior
WPF apps should build without errors in .NET SDK 9 as they did in .NET SDK 8.
### Actual behavior
Building with .NET SDK 9 is broken if there is a `Directory.Build.props` file with a custom `` property.
### Regression?
Yes, it worked up to .NET SDK 8.0.403. Broken since 9.0.100.
### Known Workarounds
_No response_
### Impact
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.