Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Compiling application for specific version of Windows without prerequisites?

Posted on 2009-05-06
2
Medium Priority
?
246 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 600 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 1400 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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.
This video teaches viewers about errors in exception handling.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Suggested Courses

618 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