Solved

Compiling application for specific version of Windows without prerequisites?

Posted on 2009-05-06
2
237 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WPF - Tooltips for ComboBox items 5 27
Iterate a dictionnary to change values 4 53
XML & .net 5 40
Run time Error 4 34
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

930 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now