4

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

2
  • It would help to provide a little code to show what you're trying to accomplish. Commented Oct 20, 2016 at 16:05
  • post a screenshot please Commented Oct 21, 2016 at 5:17

5 Answers 5

10

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.

Sign up to request clarification or add additional context in comments.

1 Comment

works for me, installed monodevelop on elementary os( which is basically ubuntu 16.04 as of now ). - June 29, 2017
5

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

1 Comment

I tried several solutions, but this seems to be the easiest one. Not sure if the one provided above (by Reinhard Gunacker) works, too. I did not check, but I cannot understand why I would need xterm or some other terminal to make console-applications work... I thought I have a terminal (MATE terminal I believe)?
5

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

Comments

4

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/

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.