Monodevelop not opening
Radivarig opened this issue · 7 comments
When I double click a script monodevelop isn't opening, but I can open monodevelop separately and then load projectname.sln file and it syncs ok. I can also call external editor, but I'd like to use monodevelop for code completion. Anyone managed to get this working?
Which script are you using? MonoDevelop only works with the PoL one unity3d.verb, it doesn't work in the minimal.
You can also use a native version of MonoDevelop with code completion, all you have to do is put a symlink to the Unity wineprefix in your project root, like so (if you were using winetricks):
ln -s ~/.local/share/wineprefixes/unity3d/drive_c ~/Projects/totally-awesome-unity-project/C:
Remember not to install any Unity add-ons into MonoDevelop.
This will kind of trick MonoDevelop, since it will look for libraries in C:/
, which would be the root on Windows, but on Linux it's relative to the project directory.
I used "winetricks -q "unity3d.verb".
Did symlink but when I double click, monodevelop opens but still doesn't open the file. I'm sending the following arguments "$(File)" $(Line)
to this script
#!/bin/sh
if [ -z "$1" ]
then
echo "No file specified"
exit 1
fi
/bin/monodevelop "`wine winepath -u "$1"`:$2:$3"
exit 0
However, sublime opens fine with same arguments.
Any specific reason it won't work with unity monodevelop addons or just not tested? (I haven't used any yet)
Will monodevelop automatically sync project .sln files?
"show in explorer" doesn't open either. Maybe the reason is the same for both
I also found this script from winehq.com
#!/usr/bin/python
#encoding: utf-8
import subprocess, os, sys
#Helper function
def winepath(path):
return subprocess.check_output(['winepath', path])
if len(sys.argv) < 3:
exit(0)
#Get project file unix path
projectFilePath = winepath(sys.argv[2])
#Get project directory
projectDir = os.path.dirname(projectFilePath)
#Get project file name without directory
projectName = os.path.basename(projectFilePath)
#Get script file name
fileName = winepath(sys.argv[3])[len(projectDir) + 1:]
#Change directory
os.chdir(projectDir)
#Open monodevelop in current directory
subprocess.call(['monodevelop', projectName, fileName])
it opens monodevelop in correct directory but it gives me error for reading .sln files
Could not load project 'project-name.unityproj' with unknown item type {...some id number ...}
I found that I have to convert mstest to nunit
but I'm not sure if I'm on the right track.
Can this be due to native monodevelop being version 5.7 and unity builtin monodevelop (for which it generates .sln) version 4.x?
No. I haven't been able to get Javascript code completion running, only C#. Since JS isn't natively support by MonoDevelop, you need an Add-on, which in turn needs Unity, but I haven't figured out how to do that yet. If you only use C#, you can use the projectname-csharp.sln
project file, which includes only C# files.
Although chances are I'm talking about a completely different error, so you can try to sync the MD files from the Unity Project view context menu. That should prepare all the files MD needs.
Yeah, I don't really use js in Unity but even if I delete the unityscript.proj files the warning is still there and no file loads. They also get created on MD sync, so I can't get use of the above script. But if we can open external editor we should be able to write a simple "redirect" of external call back to built-in which would solve all current issues (opening, unityscript and addons)
Ha!
The reason why builtin MD wasn't opening was because wineprefix wasn't set correctly.
Figured this after getting "Could not load Mono into this process" when trying to open MD from terminal.
Here is the whole script I use:
external_script_editor.sh
assign it to Unity3d>Edit>Preferences>ExternalTools
with arguments "$(File)" $(Line)
#!/bin/sh
if [ -z "$1" ]; then exit 1; fi;
#/bin/subl "`wine winepath -u "$1"`:$2:$3" #use this for opening in any other native text editor, but check how their command line arguments should be formatted!!
export WINEPREFIX=~/.local/share/wineprefixes/unity3d/
wine ${WINEPREFIX}unity3d/drive_c/Program\ Files/Unity/MonoDevelop/bin/monodevelop.exe "$1;$2"
exit 0
\m/