Solved

Compiling application for specific version of Windows without prerequisites?

Posted on 2009-05-06
2
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

688 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