jooty
jooty
CC#
Created by jooty on 9/8/2024 in #help
Generated files are not being emitted
I have a source generator which I know is functioning. Viewing the assembly in JetBrains Rider, I can see that all the generated files are present within the assembly and are still there beyond cache resets and rebuilds. I'm trying to view the generated files within VSCode, which to my understanding currently isn't possible to view the direct assembly as in Rider. As an alternative, I want them to emit to a certain directory and have my compiler just ignore them for builds. As of now, I see the "Generated" directory appear on builds. However, it is completely empty. These are the settings I have present on my consumer project (as in, the one referencing the source generator).
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
</PropertyGroup>

<Target Name="CleanSourceGeneratedFiles" BeforeTargets="BeforeBuild"
DependsOnTargets="$(BeforeBuildDependsOn)">
<RemoveDir Directories="Generated" />
</Target>

<ItemGroup>
<Compile Remove="$(CompilerGeneratedFilesOutputPath)/*.cs" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
</PropertyGroup>

<Target Name="CleanSourceGeneratedFiles" BeforeTargets="BeforeBuild"
DependsOnTargets="$(BeforeBuildDependsOn)">
<RemoveDir Directories="Generated" />
</Target>

<ItemGroup>
<Compile Remove="$(CompilerGeneratedFilesOutputPath)/*.cs" />
</ItemGroup>
What am I missing here?
3 replies