You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing to report an issue encountered when disabling the IncludePackageReferencesDuringMarkupCompilation feature in a WPF project setup. The problem arises during the build process when XAML files are referenced across projects and added as links.
Disabling the IncludePackageReferencesDuringMarkupCompilation feature leads to the following issues:
When referencing XAML files from another project and adding them as links, the build process fails with error CS1504.
The generated g.cs files from XAML contain incorrect relative file paths in the #pragma checksum directive, causing the build to fail.
Reproduction Steps
Create two WPF projects:
A WPF Library project.
A WPF Application project.
In the WPF Library project, add a user control named MyUserControl.
In the WPF Application project, reference the MyUserControl.xaml and MyUserControl.xaml.cs files using the following code:
The build process should correctly handle XAML file references and generate accurate paths in the g.cs files, even with the IncludePackageReferencesDuringMarkupCompilation feature disabled.
I would appreciate your assistance in investigating this issue and providing a resolution or workaround.
Thank you for your attention to this matter.
Actual behavior
With the IncludePackageReferencesDuringMarkupCompilation feature disabled, attempting to build the WPF Application project results in the following error:
obj\Debug\net9.0-windows\MyUserControl.g.cs(59,21,59,41): error CS1504: Cannot open source file "MyUserControl.xaml" -- Could not find file
This error indicates that the generated g.cs file contains an incorrect relative path for MyUserControl.xaml, leading to a build failure.
The first line code content of MyUserControl.g.cs:
Description
I am writing to report an issue encountered when disabling the
IncludePackageReferencesDuringMarkupCompilation
feature in a WPF project setup. The problem arises during the build process when XAML files are referenced across projects and added as links.Disabling the
IncludePackageReferencesDuringMarkupCompilation
feature leads to the following issues:g.cs
files from XAML contain incorrect relative file paths in the#pragma checksum
directive, causing the build to fail.Reproduction Steps
MyUserControl
.MyUserControl.xaml
andMyUserControl.xaml.cs
files using the following code:Disable the
IncludePackageReferencesDuringMarkupCompilation
feature in the WPF Application project by modifying its.csproj
file as shown below:You can find my repro project in github
Expected behavior
The build process should correctly handle XAML file references and generate accurate paths in the
g.cs
files, even with theIncludePackageReferencesDuringMarkupCompilation
feature disabled.I would appreciate your assistance in investigating this issue and providing a resolution or workaround.
Thank you for your attention to this matter.
Actual behavior
With the
IncludePackageReferencesDuringMarkupCompilation
feature disabled, attempting to build the WPF Application project results in the following error:This error indicates that the generated
g.cs
file contains an incorrect relative path forMyUserControl.xaml
, leading to a build failure.The first line code content of MyUserControl.g.cs:
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
No response
Other information
Reference:
Reference #7556
The text was updated successfully, but these errors were encountered: