C#MonoDevelop:无效的-langversion CS1617

时间:2014-06-17 05:49:14

标签: c# mono monodevelop

我刚刚在Ubuntu 12.04中安装了MonoDevelop 5.0.1,并尝试编译一个简单的Hello World。 这会导致以下构建错误:

Error CS1617: Invalid -langversion option `Version5'. It must be `ISO-1', `ISO-2', `3', `4', `5', `Default' or `Future' (CS1617)

我查看了选项,我找到的所有内容似乎都设置正确。编辑>偏好设置>项目> .NET Runtimes包含Mono 3.2.1。

我唯一无法访问的部分是Project> Project Options> Build> General,它会导致抛出异常:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Unknown LangVersion string ''
  at MonoDevelop.CSharp.Project.CSharpCompilerParameters.get_LangVersion () [0x00000] in <filename unknown>:0 
  at MonoDevelop.CSharp.Project.CompilerOptionsPanelWidget..ctor (MonoDevelop.Projects.DotNetProject project) [0x00000] in <filename unknown>:0 
  at MonoDevelop.CSharp.Project.CompilerOptionsPanel.CreatePanelWidget () [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.CreatePageWidget (MonoDevelop.Ide.Gui.Dialogs.SectionPage page) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.ShowPage (MonoDevelop.Ide.Extensions.OptionsDialogSection section) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.OnSelectionChanged (System.Object s, System.EventArgs a) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0 
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0 

MonoDevelop 2中已经发生了同样的错误。来自Ubuntu软件包管理器。

2 个答案:

答案 0 :(得分:0)

我无法帮助你解决方案,但我可以告诉你为什么会这样 -

请访问此链接 -

  1. 原因http://msdn.microsoft.com/en-us/library/ydy7a2we(v=vs.90).aspx

  2. Mono开发系统要求。

  3. http://monodevelop.com/developers/building_monodevelop

    确保MonoDeveloper支持您正在使用的Mono版本。

答案 1 :(得分:0)

我(我想)发现了这个问题,现在它似乎正常工作了。显然,其中一个项目文件由于某种原因被破坏了。删除旧项目并创建新项目有帮助。