About the Visual C# Express Editor limitation

The unity environment doesn't allow you to use Visual C# Express 2008 as the external editor, saying it can't be handled from outside. I was wondering if this is a legal/license limitation or a technical one.

If it is a technical limitation, I found this workaround by using DDE: 1) download ClassExec from http://fvue.nl/wiki/ClassExec 2) Create a batch file (I used runvc.bat) in the same directory where you opened ClassExec, and put in the following contents :

classexec %1 --class .cs

3) Associate the batch file as your external editor in unity. 4) If Visual C# Express is open in the background and has the sync'ed solution open, when you double click a script in the unity editor the selected file will open in the existing Visual C# window, allowing you to edit it with code completion and all the fun features.

I'm considering adding this workaround to the unity wiki, but don't want to do anything evil. Is this legal?

We use COM to control visual studio pro to open the correct file at the correct line. Microsoft disabled COM suport for visual studio express. I've tried several different ways to make it do what we want anyway, but in the end, I couldn't get any of these more hacky methods working reliably on different machines with different language settings etc.

Please note that you can still use Visual Studio Express just fine to open the generated .sln file, and edit with autocompletion etc.

Can't comment on the legality of it (IANAL) although my guess would be that it isn't illegal.

However you might want to consider this trick - rename your copy of Uniscite.exe to some other name to preserve it as a backup (eg, "UnisciteBackup.exe"). Then place your batch file in the same folder, with the original name of the Uniscite exe. Make sure 'uniscite' is selected as the default editor, and you'll find that Unity passes the line number along as a parameter too! (it doesn't seem to do this if you select a different external editor).

Now, I haven't used "ClassExec" before, but if it supports it some method of doing so, you can then incorporate the line number into your script so it jumps to the correct line :)

I don't see why it'd be illegal, or even against either of the licenses. What that Unity error means is probably that they didn't program Unity to command Visual Studio to open and move to a line.

As a slightly tangential addition to the OP's classexec workaround, you can also route which IDE is loaded by the .bat file with a small addition, for instance, i send the .js and .shader filetypes to the UnityDevelop, but you can just as easily have them open in UniSciTE.exe (in your programfiles\unity\editor\data ools\uniscite dir.. )

set classExecPath="C:\classexec\classexec.exe"
set UnityDevelopPath="C:\Program Files\UnityDevelop\Unitydevelop.exe"
GOTO :%~x1

:.cs
ECHO "CS PATH"
%classExecPath% %1 --class .cs
GOTO :endscript

:.js
ECHO "JS PATH"
%UnityDevelopPath% %1
GOTO :endscript

:.shader
ECHO "SHADER PATH"
%UnityDevelopPath% %1
GOTO :endscript

:endscript

I followed the classexec %1 --class .cs instructions from the original poster and all it does is open the cs files in WordPad. :(

this solution works for me. VS2010+VistaX64