![](/img/trans.png)
[英]When using the C#9 Source Generator, how to ensure files are generated to specific location/file path?
[英]VS Code is not aware of the code generated by c#9 source generators
我有一个控制台应用程序,它引用了一个包含源生成器的项目。
一切正常,代码运行并执行预期的操作,但 VS Code 不知道生成的代码。
我的项目中有一个 class
public partial class Foo
{
public partial int GetNum();
}
在引用的项目中,我生成了这个部分方法的实现:
public void Execute(GeneratorExecutionContext context)
{
var source = @"namespace MyNamespace
{
public partial class Foo
{
public partial int GetNum() => 23;
}
}";
if (source != null)
{
context.AddSource("generated.cs", source);
}
}
如何告诉 VS Code 考虑生成代码?
通过将生成器项目设置为 netstandard2.0 来修复它
https://github.com/OmniSharp/omnisharp-roslyn/issues/1934#issuecomment-706329123
但 go 定义不起作用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.