monodevelop cannot execute project

老子叫甜甜 提交于 2019-12-04 18:53:22

I had the same problem, here is my solution.

OS: Linux Mint 18.1 Cinnamon 64-Bit

Monodevelop: 6.1.2.44 flatpak installation

afaik MonoDevelop needs xterm or gnome-terminal for running a program in an external console. If both are missing you get "Cannot execute..." errors.

The MonoDevelop log shows: ~/.var/app/com.xamarin.MonoDevelop/cache/MonoDevelop-6.0/Logs/Ide.log

ERROR [2017-01-10 19:47:49Z]: Cannot execute "/home/...exe"
System.InvalidOperationException: Cannot start process because a file name has not been provided.

In my case i had to install xterm and copy it and it's dependencies to the flatpak runtime:

sudo apt-get install xterm
cp -v /usr/bin/xterm ~/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/1.4/active/files/bin/
cp -v /usr/lib/x86_64-linux-gnu/libXaw* ~/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/1.4/active/files/lib/
cp -v /usr/lib/x86_64-linux-gnu/libXmu* ~/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/1.4/active/files/lib/
cp -v /usr/lib/x86_64-linux-gnu/libutempter* ~/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/1.4/active/files/lib/
cp -v /lib/x86_64-linux-gnu/libpng12* ~/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/1.4/active/files/lib/
cp -v /lib/x86_64-linux-gnu/libtinfo* ~/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/1.4/active/files/lib/

Maybe not the best solution but it works for me.

Here's an automated two-liner for the "copy xterm" approach (tested on Ubuntu 16.04):

ldd `which xterm` | awk '{if ($2 == \"=>\") print $3}' | grep / | xargs -I{} cp -Lnv {} .local/share/flatpak/runtime/org.freedesktop.Sdk/x86_64/1.4/active/files/lib/
cp -nv `which xterm` .local/share/flatpak/runtime/org.freedesktop.Sdk/x86_64/1.4/active/files/bin/

I found a couple of ways around this:

1. Instead of creating a console application, create a GTK 2.0 project. For example:

using System;
using Gtk;

namespace Test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            /*Application.Init();
            MainWindow win = new MainWindow();
            win.Show();
            Application.Run(); */
            Console.WriteLine("Hello World");
        }
    }
}

And in the Application Output pad, you will see "Hello World".

  1. install mono-runtime (sudo apt-get install mono-runtime) and go to the bin/Debug/ directory. There you will find an .exe file and you can simply execute it as ./{{NameOfProject}}.exe

I had to open a terminal window in Linux Mint Sylvia, and switch to the Project's name, then from there to the bin/Debug folder. I saw that there was an exe created by monoDevelop. I changed the exe's mode to executable. Then I ran the exe by typing its name.exe and it worked.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!