使用Microsoft.CodeAnalysis.Emit编译VB项目时出现BC30002错误

时间:2017-04-03 13:09:29

标签: vb.net roslyn roslyn-code-analysis

我正在使用Microsoft.CodeAnalysis.Emit来编译Visual Basic项目并使用以下编译选项生成.dll文件。

/somedir/

我试图编译的所有VB项目的发射器抛出以下错误。请告知如何解决此问题。

  

vstest.executionengine.x86.exe错误:0:xxxxx - ,   C:\ Projects \ xxxx \ xxxxx \ My Project \ Settings.Designer.vb(67,48):错误   BC30002:输入'Global.xxxx.xxxx.Console.VBTestApp.My.MySettings'是   没有定义。

1 个答案:

答案 0 :(得分:1)

要正确编译生成的Settings.Designer.vb文件,必须将项目的根命名空间设置为生成文件的同名。在您的情况下,这似乎是xxxx.xxxx.Console.VBTestApp,因此您的选项应该是:

new VisualBasicCompilationOptions(
    OutputKind.DynamicallyLinkedLibrary,
    optimizationLevel: OptimizationLevel.Debug,
    rootNamespace: "xxxx.xxxx.Console.VBTestApp")
相关问题