Solved

Compiling application for specific version of Windows without prerequisites?

Posted on 2009-05-06
2
241 Views
Last Modified: 2013-11-25
I need to create an application to run in a Windows environment without any runtimes being installed first. I'm developing in Visual Studio 2005/2008. Is there a way to use C++ or C# in such an environment?
0
Comment
Question by:InterWorks
2 Comments
 
LVL 22

Assisted Solution

by:cookre
cookre earned 150 total points
ID: 24321111
c# will require some version of the .net framework - which comes with only a few versions of Windows.

c++ presumes only the standard win32 apis.
0
 
LVL 9

Accepted Solution

by:
tculler earned 350 total points
ID: 24321303
There is no way to do this with C#; however, as previously stated, C++ presumes only the standard Windows API's, and thus operates only on those present in -all- Windows machines (by all, I mean it should be all, though results always vary in this field...).

C# relies solely on the .NET Framework, and MUST run within the context of the CLR (Common Language Runtime). All of your Managed code (for example, all of your C# code) gets compiled to what we call MSIL (Microsoft Intermediate Language), or IL, for short. A computer without the CLR cannot decipher this MSIL because that is the job of the CLR--it JIT (Just-In-Time) "compiles" this IL down to native code at run-time. However, native C++ does not have this problem. Its code is directly compiled to native, and is run accordingly.

However, if you do use C++ and you plan on running the app in an environment which won't have access to the CLR, you MUST use Unmanaged C++, NOT Managed. Managed C++ is basically just C#, but with C++ syntax and capabilities (in other words, it requires the .NET Framework and the CLR to run in).

Just because IL must be JIT compiled doesn't necessarily mean it runs any slower than Native code, though. Native code loads everything into memory immediately, while the CLR compiles and runs things only as they are needed, many times saving memory.

I believe there is an alternative, here, however, where you can create a native "image" of the IL code with a program called "Ngen.exe". I don't know much about it, so I'll just post a link like a lame-ass. <a href="http://msdn.microsoft.com/en-us/library/6t9t5wcf(VS.80).aspx">Here's the link</a>
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question