【问题标题】:Xamarin Monodevelop - Error CS0103Xamarin Monodevelop - 错误 CS0103
【发布时间】:2014-11-12 23:42:48
【问题描述】:

我刚刚在 Mac OSX 上安装了 Xamarin Monodevelop,我创建了一个 GTK# 项目,其中我有一个非常基本的窗口,我什至没有接触过。这是它在Build(); 上给我的错误

Error CS0103: The name 'Build' does not exist in the current context

using System;
using Gtk;

public partial class MainWindow: Gtk.Window
{
    public MainWindow () : base (Gtk.WindowType.Toplevel)
    {
        Build ();
    }

    protected void OnDeleteEvent (object sender, DeleteEventArgs a)
    {
        Application.Quit ();
        a.RetVal = true;
    }
}

【问题讨论】:

    标签: macos xamarin monodevelop gtk#


    【解决方案1】:

    Build 方法由 Stetic UI 构建器创建,类似于 Visual Studio UI 构建器的 InitializeComponents

    Xamarin Studio(我使用的是 5.5.4.15)中似乎存在一个错误,除非您将小部件添加到窗口,否则不会生成 Build 方法。尝试添加 VBox 或其他容器,然后重新构建。

    【讨论】:

    • 我遇到了类似的问题。我添加了几个小部件,但仍未生成 Build 方法。它是否应该在运行中自动生成和更新,通过一些我没有理解的过程手动生成,还是应该在构建时生成?
    • 它应该由Stetic UI builder创建。你用的是单声道开发吗?什么版本?
    • 我确实在使用MonoDevelop,详情如下。顺便说一句,当我将操作处理程序添加到我的小部件时,模板方法会适当地添加到 MainWindow 部分类... --- MonoDevelop 5.7 版安装 UUID:11d14ce4-f55c-4a71-b43b-53592db129a1 运行时:Mono 3.12.1(tarball Fri Mar 6 19:12:47 UTC 2015)(64 位)GTK+ 2.24.23(delorean-dark-3.10 主题)构建信息构建信息不可用操作系统 Linux Linux tony-HP 3.13.0-49-generic #83- Ubuntu SMP 2015 年 4 月 10 日星期五 20:11:33 UTC x86_64 x86_64 x86_64 GNU/Linux
    • 那时它肯定应该在那里。你能从一个空的项目中重现这个吗?如果是这样,请提交bug in the stetic project
    • 谢谢,我会的。刚刚查看了一个新项目的 gtk-gui 文件夹。 stetic 文件与 generate.cs 和 MainWindow.cs 一样存在,但 MainWindow.cs 仅包含打开和关闭大括号,而不包含窗口构建代码。看起来像是某种不当行为。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多