Compile-time errors in generated code #19
-
Hi, Any idea what could be the issue here? My csproj looks like this: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<RootNamespace>Viewer</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
<PackageReference Include="PropertyChanged.SourceGenerator" Version="1.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Stylet" Version="1.3.6.0" />
</ItemGroup>
</Project> My viewmodel looks like: using PropertyChanged.SourceGenerator;
namespace Viewer.Pages;
public partial class HexConfigurationViewModel
{
[Notify] int _ringCount = 5;
} and the errors I get are:
I also tried adding the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 25 replies
-
Interesting. I can't replicate this using that csproj and ViewModel. It's really weird that you're seeing generated files in |
Beta Was this translation helpful? Give feedback.
Interesting. I can't replicate this using that csproj and ViewModel.
It's really weird that you're seeing generated files in
PropertyChanged.SourceGenerator\PropertyChanged.SourceGenerator.PropertyChangedSourceGenerator
. The generated files should be kept safely in theobj
folder (there's an option for moving them out of there, but your csproj doesn't have that enabled). Did you move the generated files there manually? Can you delete them and see whether that fixes the issue?