Proposal: Exclude CompilerGeneratedFilesOutputPath
from Compilation by Default
#47046
Labels
CompilerGeneratedFilesOutputPath
from Compilation by Default
#47046
Problem
When
CompilerGeneratedFilesOutputPath
is set in csproj, the .NET SDK emits source generator output to disk. However, these files are not excluded from compilation by default, leading to errors when runningdotnet build
a second time.Currently, developers must manually add:
Without this, builds fail due to duplicate type definitions: https://andrewlock.net/creating-a-source-generator-part-6-saving-source-generator-output-in-source-control/#excluding-emitted-files-from-the-compilation
Proposal
The .NET SDK should automatically exclude the
CompilerGeneratedFilesOutputPath
from compilation when it is set, preventing these errors.Would love to hear thoughts on whether this can be supported natively!
The text was updated successfully, but these errors were encountered: