i have install monodevelop and write 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.
screenshot added
screen shot
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.
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".
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 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
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 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.
Related
Trying to install Matlab run time on a docker image along with the project I'm working on, the project is an engine that will run a variety of measurements based on what is given to it, many of these measurements use Matlab. When I run the docker though I get an error that the "MWArray assembly failed to be initialized" or that a matlab dll is missing.
I'm trying to run this in Docker for Windows due to a company requirement, and have been unable to successfully get the DockerFile to recognize the MCR. Below is the code that I've been playing with to get the MCR onto a docker.
FROM mcr.microsoft.com/dotnet/framework/runtime:4.7.2-windowsservercore-ltsc2019
ADD http://ssd.mathworks.com/supportfiles/downloads/R2017b/deployment_files/R2017b/installers/win64/MCR_R2017b_win64_installer.exe C:\\MCR_R2017b_win64_installer.zip
# Line 3: Use PowerShell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Line 4: Unpack ZIP contents to installation folder
RUN Expand-Archive C:\\MCR_R2017b_win64_installer.zip -DestinationPath C:\\MCR_INSTALLER
# Line 5: Run the setup command for a non-interactive installation of MCR
RUN Start-Process C:\MCR_INSTALLER\bin\win64\setup.exe -ArgumentList '-mode silent', '-agreeToLicense yes' -Wait
# Line 6: Remove ZIP and installation folder after setup is complete
RUN Remove-Item -Force -Recurse C:\\MCR_INSTALLER, C:\\MCR_R2017b_win64_installer.zip
WORKDIR /app
COPY /Project/bin/Debug/*.dll ./
COPY /Project/bin/Debug/Project.exe .
ENTRYPOINT ["C:\\app\\Project.exe"]
Edit: I think I've found a working solution, following the idea from the other anwser about the ltsc2019 not working with Matlab 2017b. The below code has worked with 2017b inside a docker.
FROM mcr.microsoft.com/windows:1809
Windows Server 2019 is not supported by MATLAB R2017b, and support for it was not introduced until MATLAB R2019a.
For MATLAB R2017b you’ll need Windows Server 2016.
That’s not to say there may not be other issues as well.
I've been searching for quite some time now, and can't seem to find an answer to this problem. Found only two questions/answers on SO and they still don't answer this question (https://stackoverflow.com/search?q=netcore+publish+mac+app).
I'm working with DotNetCore on Mac, using Visual Studio as the IDE. The app is a Console App, not an ASP.Net app, simple "Hello World" app in C#:
...
Console.Writeline("Hello World");
...
So here's the question... To run the app, I know I can use the "dotnet" command to run it. I'm trying to build/publish the app, as you normally would do in Windows by creating an .exe file, but now on Mac by creating a native binary file.
I have found zero documentation on how to do this, and deploy the application as a self contained app that can run independently without having to call the program using the "dotnet" command. Maybe I'm looking in the wrong places but haven't even found anything on Microsoft's documentation, they all point to documentation for building ASP.Net apps on .NetCore.
Any suggestions?
Found the answer by looking at the "dotnet publish" options:
dotnet publish -c Release --self-contained -r osx.10.13-x64
Where --self-contained includes all required libraries, and -r specifies the runtime target.
$ dotnet publish -c Release --self-contained -a x64
Determining projects to restore...
Restored /Users/walshca/code/temp/MutexThrow/MutexThrow.csproj (in 155 ms).
MutexThrow -> /Users/walshca/code/temp/MutexThrow/bin/Release/net6.0/osx-x64/MutexThrow.dll
MutexThrow -> /Users/walshca/code/temp/MutexThrow/bin/Release/net6.0/osx-x64/publish/
dotnet publish docs
Then I run ./bin/Release/net6.0/osx-x64/publish/MutexThrow
This didn't specify the --output cli arg, so you can see in the build output it defaulted to [project_file_folder]/bin/[configuration]/[framework]/[runtime]/publish/
(In dotnet 6.0 instead of -r runtime target, you can specify --arch x86 and it uses the default RID for your system.)
If your project props sets a different build output, can you find the executable by enumerating files by unix file permissions:
$ gci -r -file | ? UnixMode -match 'x$' | % FullName
/Users/walshca/code/temp/MutexThrow/obj/Release/net6.0/osx-x64/apphost
/Users/walshca/code/temp/MutexThrow/bin/Release/net6.0/osx-x64/MutexThrow
/Users/walshca/code/temp/MutexThrow/bin/Release/net6.0/osx-x64/publish/MutexThrow
I'm trying to learn some C# and am currently using the internal console for outputs, but when it comes to keyboard inputs, I've read that it can not be done in the internal console on VS 2017 for Mac.
So I try to do it on external console, but all I get is this :
bash -c 'clear; cd "/Users/gb/Projects/reTest/reTest/bin/Debug";
"/Library/Frameworks/Mono.framework/Versions/5.8.1/bin/mono32"
--debug --debugger-agent=transport=dt_socket,address=127.0.0.1:56795 "/Users/gb/Projects/reTest/reTest/bin/Debug/reTest.exe" ; echo $? >
/var/folders/s_/sljf42_d01bdxlb5s_rwgsj80000gn/T/tmp563f24ea.tmp;
echo; read -p "Press any key to continue..." -n1; exit'; exit
I guess the console tries to execute a .exe application which is not possible in this case !
It's a console project by the way... I haven't found any solution for that so far.
Thks.
After further researches I found out that my bash was kind of corrupted somehow so I modified the .bash_profile file which had some extra inconvenient text..
What do I need to install/configure to run the following makefile on windows 7:
MONO = mono
MONOC = gmcs
MONOCFLAGS = -optimize -reference:${PARSERREF}
GPLEX = ${MONO} gplex.exe
GPPG = ${MONO} gppg.exe
PARSERREF = bin/ShiftReduceParser.dll
CSFILES = Absyn.cs Parser.cs Printer.cs Scanner.cs Test.cs VisitSkeleton.cs AbstractVisitSkeleton.cs
all: test
clean:
rm -f test.pdf test
distclean: clean
rm -f ${CSFILES}
rm -f test.l test.y test.tex
rm -f Makefile
test: Parser.cs Scanner.cs
#echo "Compiling test..."
${MONOC} ${MONOCFLAGS} -out:bin/test.exe ${CSFILES}
Scanner.cs: test.l
${GPLEX} /out:$# test.l
Parser.cs: test.y
${GPPG} /gplex test.y > $#
I have always used Visual Studio, however, this time, this is generated by BNFC (Parser generator). I don't see the csc.exe (CSharp compiler) in this makefile. Can someone please explain this to me?
Note: I have got gplex.exe and gppg.exe and I have .NET installed on my machine.
You need to download and install GNU make for Windows
http://gnuwin32.sourceforge.net/packages/make.htm
Afterwards you open cmd.exe and cd to the directory where the makefile is in.
Then you type make and press enter, or make test in this case.
As per suggestions from this thread on running C# apps sans .NET I've compiled my app using mono. I built the original app using the latest Visual C# .NET Express Edition. It runs fine on .NET on Windows. I then opened up Cygwin and navigated to my source where I compiled the project again, under mono using the following command:
$ mcs <myProjectHere>.cs
This produces MyProject.exe, which can be run from within Cygwin with success, and can be run from the Window command line successfully. Commands used are:
$ mono MyProject.exe
C:\...>mono MyProject.exe
and just for kicks, simply:
C:\...>MyProject.exe
All work as expected. I then tried to build the mono compiled executable into a statically linked binary using the mkbundle command as follows:
$ mkbundle -o MyProject MyProject.exe --deps
This is where things begin to go downhill. It starts off well enough and then complains that the output file (presumably, MyProject.exe) cannot be opened because it is busy. The full output of it all is here:
$ mkbundle -o Program Program.exe --deps
OS is: Windows
Sources: 1 Auto-dependencies: True
embedding: c:\Documents and Settings\bsweeney\My Documents\Visual Studio 2008
\Projects\TestConsole\TestConsole\Program.exe
embedding: C:\PROGRA~1\Mono-2.2\lib\mono\2.0\mscorlib.dll
Compiling:
as -o temp.o temp.s
gcc -mno-cygwin -g -o Program -Wall temp.c `pkg-config --cflags --libs mono|dos2
unix` temp.o
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/bin/ld: cannot op
en output file Program.exe: Device or resource busy
collect2: ld returned 1 exit status
[Fail]
I claim that my unix gcc toolchain is installed and in good condition because I've been able to successfully compile a few c++ apps in eclipse using it recently (although i supposed i should be open to any number of problems...).
Anyone ever run into anything like this? I'm stumped...
It seems like it's trying to output into MyProject.exe, which is the same as the input file.
Try running
$ mkbundle -o ProgramOutput Program.exe --deps
This is just a guess, by the way, since I don't know mkbundle.