Saeid Shakiba
Saeid Shakiba

Reputation: 35

monodevelop cannot execute project

I have installed monodevelop and have written a hello world program in C# console but when in run configuration I choose "run in external console" check box and click on run button monodevelop says: Cannot execute "{Project Path}"

Os: Debian, Kali 2

Edit: and Console.ReadLine() Doesn't work in default run configuration.

screen shot

Upvotes: 4

Views: 10130

Answers (5)

Tom
Tom

Reputation: 6719

I had this problem on on Ubuntu 20.04 (using the latest monodevelop from PPA)

It was because on 20.04,

gnome-terminal-server had moved from /usr/lib/gnome-terminal/ to /usr/libexec/

Monodevelop needs to be updated to take care of this.

My temporary fix:

cd /usr/lib
sudo mkdir gnome-terminal
sudo ln -s /usr/libexec/gnome-terminal-server

Upvotes: 5

bram
bram

Reputation: 11

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.

Upvotes: 1

Uri Simchoni
Uri Simchoni

Reputation: 326

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/

Upvotes: 4

Rhs
Rhs

Reputation: 3318

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

Upvotes: 5

Reinhard Gunacker
Reinhard Gunacker

Reputation: 101

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.

Upvotes: 10

Related Questions