Open snltty opened 3 hours ago
Source generator related questions belong to https://github.com/dotnet/roslyn/discussions .
How are you publishing with trim enabled? You should set PublishTrimmed
property in the entry application or command line, not in the source generator project.
如上面的代码,源生成器项目linker.gen中没有设置PublishTrimmed ,是linker项目引用了linker.gen,使用dotnet publish 发布linker项目。指定了裁剪
linker.gen
这是一个源生成器项目,里面使用了IIncrementalGenerator,我希望这个生成器能自动帮我查找一些接口有哪些实现,,然后为一些类自动添加 GetSourceGeneratorTypes 方法,获取这些实现
linker
然后我在linker项目中引用 linker.gen
当我在DEBUG下时,这正常使用,满足的我需求,当我需要发布 linker项目,并且启用裁剪时,会发布失败
严重性 代码 说明 项目 文件 行 禁止显示状态 详细信息 错误 修整程序集需要 .NET Core 3.0 或更高版本。 linker C:\Program Files\dotnet\sdk\8.0.303\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets 90