Skip to content

[.NET 8 Regression] error CS1504: Source file "<Path to XAML>" could not be opened --- Could not find file #34438

Open
@WardenGnaw

Description

@WardenGnaw

Describe the bug

A .NET project fails to build with the .NET 8 SDK but succeeds with the .NET 7 SDK. It seems to be an issue with the WPF generated source files not being able to find the original XAML file.

To Reproduce

  1. Have .NET 8 SDK 8.0.100-preview.6.23330.14
  2. Checkout https://github.com/microsoft/MIEngine/tree/main
  3. Run dotnet build src\MIDebugEngine.sln
  4. See error logs
Errors Logs
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(49,18): error CS1504: Source file 'UI\Containe
rPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2gao
z2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(57,19): error CS1504: Source file 'UI\Containe
rPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2gao
z2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(65,19): error CS1504: Source file 'UI\Containe
rPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2gao
z2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(73,19): error CS1504: Source file 'UI\Containe
rPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2gao
z2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(81,19): error CS1504: Source file 'UI\Containe
rPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2gao
z2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(89,19): error CS1504: Source file 'UI\Containe
rPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2gao
z2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(97,19): error CS1504: Source file 'UI\Containe
rPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2gao
z2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(105,19): error CS1504: Source file 'UI\Contain
erPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2ga
oz2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(113,19): error CS1504: Source file 'UI\Contain
erPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2ga
oz2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(121,19): error CS1504: Source file 'UI\Contain
erPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2ga
oz2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(129,19): error CS1504: Source file 'UI\Contain
erPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2ga
oz2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(137,19): error CS1504: Source file 'UI\Contain
erPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2ga
oz2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(145,19): error CS1504: Source file 'UI\Contain
erPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2ga
oz2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(166,21): error CS1504: Source file 'UI\Contain
erPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2ga
oz2_wpftmp.csproj]
C:\src\MIEngine\obj\Debug\SSHDebugPS\UI\ContainerPickerDialogWindow.g.cs(246,23): error CS1504: Source file 'UI\Contain
erPickerDialogWindow.xaml' could not be opened -- Could not find file. [C:\src\MIEngine\src\SSHDebugPS\SSHDebugPS_zh2ga
oz2_wpftmp.csproj]

Note: The build works if you use a .NET 7 SDK like
dotnet "C:\Program Files\dotnet\sdk\7.0.109\dotnet.dll" build src\MIDebugEngine

Exceptions (if any)

None. This is just dotnet build

Further technical details

  • Include the output of dotnet --info
dotnet --info output
.NET SDK:
 Version:   8.0.100-preview.6.23330.14
 Commit:    ba97796b8f

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22621
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.100-preview.6.23330.14\

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.0-preview.6.23329.7
  Architecture: x64
  Commit:       5340be2ccc

.NET SDKs installed:
  7.0.200 [C:\Program Files\dotnet\sdk]
  7.0.306 [C:\Program Files\dotnet\sdk]
  8.0.100-preview.3.23178.7 [C:\Program Files\dotnet\sdk]
  8.0.100-preview.6.23330.14 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-preview.3.23177.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-preview.6.23329.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-preview.3.23174.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-preview.6.23329.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0-preview.3.23178.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0-preview.6.23329.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
    VS Version does not matter as this repros with just the dotnet commandline but it reproduces with Visual Studio 17 Preview 7.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions