Jump to content

.NET Framework on U3?


Recommended Posts

I just used a good friend and it returned the following answer:

Not possible except you make your OS also installed on "USB drive" or redesign .NET Framework ), .NET Framework should be installed on your machine, otherwise, .NET Framework application won't find it and fire out .NET Framework not found exception.

You'd consider wrapping your application with .NET Framework bootstrapper in a Setup project to ship.

Link to comment
Share on other sites

  • 2 months later...

You'll have a hard time making a simple, portable Microsoft .NET runtime, but there are alternatives.

If it's suitable, you could carry around a VM of some Windows OS with .NET installed, and transfer data in and out. Not ideal, but it's a clean way to run .NET apps for sure. But there is a nice alternative...

Mono is a free implementation of the .NET runtime for a number of platforms. The Windows version is a cinch to make portable. After installing it (Mono 1.9.1 in this case) to any location of your choosing, make a shortcut in the folder above it pointed at C:\WINDOWS\system32\cmd.exe /k ".\Mono-1.9.1\bin\setmonopath.bat". Although it appears to be an annoyance that a shortcut can't directly use a relative link, it doesn't matter, since we're planning to open a command prompt anyway (with a modified PATH variable). Now we need to modify setmonopath.bat to create our new MWD (Mono Working Directory).:

@echo off
echo Mono version 1.9.1 Build 2
SET MWD=%CD%\Mono-1.9.1
echo Prepending %MWD%\bin to PATH

Now modify every batch file in the Mono /bin directoy, replacing every path up to and including MONO-1~1.1 with %MWD%.

If you installed Mono in the default location, cert2spc for example would change as follows:


@"C:\PROGRA~1\MONO-1~1.1\bin\mono.exe" "C:\PROGRA~1\MONO-1~1.1\lib\mono\1.0\cert2spc.exe" %*


@"%MWD%\bin\mono.exe" "%MWD%\lib\mono\1.0\cert2spc.exe" %*

I've taken the liberty of creating a simple graphical demonstration app and running under Microsoft .NET (3.5, not that it mattered any) and Mono (1.9.1). See the results at http://bayimg.com/BAKopaaBH. If you follow this, you'll be able to execute .NET applications using your Mono environment without needing .NET installed. More so, Mono even comes with compilers for C# and VB.NET, and a Boo interpreter or translator by memory.

Bare in mind that Mono will always be playing catch-up to .NET, but it's quite capable. Certainly worth a look if you prefer free software, and this hackish approach. ;) There is another, free .NET implementation called DotGNU Portable.NET, but to be completely honest, I haven't looked at it at all; I've been following Mono for a long time and I'm more than pleased with it. Just figured I should throw that in for completeness though.

This is my first post on the forums btw, I only looked at them for the first time a few weeks back, but I've been watching Hak5 eps since the start. Keep up the great work guys. ;)

-Uda in Australia

Link to comment
Share on other sites

Or you could just write NATIVE UNMANAGED code which can be run on any windows machine with no dependencies at all!

You're completely missing the point... the question was how to "run .NET app's without need to install .NET framework on the host's machine". That implies running precompiled .NET bytecode executables, nothing was said about coding an application, and choice of language.

You are basically asking why use something like a .NET runtime, when something could be written and compiled as native code. As much as I don't want to argue for .NET (I don't like it a great deal), runtime environments like this and that of Java have some pros over native executables, just as they have some over those requiring a runtime. Perhaps you're not aware that Mono is not Windows exclusive, and so the same executable that can be run under a portable Mono environment on Windows can be run under Mono on Linux without requiring access to the source to make modifications for the different OS. The .NET/Mono platform takes care of it.

You can go around praising old school coding and unmanaged executables as much as you want, but runtime environments and interpreters exist for a reason, and a portable Mono helps extend the reach of the intended advantages.

If you wish to continue this track of conversation, I suggest you start an appropriate thread in another section of the forum.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...