'Cannot access included files SourceGenerator
I added this ItemGroup to the SourceGenerator.csproj file
<ItemGroup>
<Content Include="defs\*\*.json" CopyToOutputDirectory="PreserveNewest" />
<Content Include="Templates\*.template" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
OBS: The files get copied to the output if i build the SourceGenerator project.
I get the path of the template file like this:
var path = Path.Combine(AppContext.BaseDirectory, "Templates", _fileName);
But, while trying to compile the Project that references this SourceCode generator i get an warning:
Generator 'SourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'DirectoryNotFoundException' with message 'Could not find a part of the path 'C:\Program Files\dotnet\sdk\6.0.300-preview.22204.3\Roslyn\bincore\Templates\Struct.template'.'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
