Hello all,

Note: This is a general question, and I did not find any other category in the forum to ask this question...

Last year, I got a copy of VS 2008 (VC 9.0) as gift. I liked it a lot! I started developing some simple applications using C ( Couldn't do much as I was in the school ). But, I was doing Project Euler problems now and then and had solved about 70 of them. Now, I have a long vacation, so I am going towards developing application based project using VC++. I studied C++ and Win32, followed later by MFC. Now, I am half-way through my project...

I was wondering, what is .NET Framework doing in the middle of my project, where, I only use Native C/C++ and not C++/CLI... I am not using any features of .NET as I know of. So, why does Visual Studio always ask me to target a Framework in my project. It is very difficult to deploy my applications to older computers and even computers which are not connected to the internet as they will not be updated with the latest .NET Framework. I have to deploy .NET Framework with my application for that reason...

So, is there any reason, why the Framework thing is important to my project, where I only use Native C/C++ with MFC?

Also, when I was doing Project Euler problems, where I used only C language (and as I did not know much, I only did console based programs), I still needed .NET Framework on the computer executing these simple problems... So, I could not use my simple, little programs even on other comps not having .NET Framework 2.0 or later...

If, it is not important to have .NET thing in my project, is there any way I can exclude it from my project, so that I can target all kind of users using windows?

Thanks in advance!

First of all for all native Applications written in C/C++ no Framework is required, well as you are using MFC in your project I think you must know the basics of Dll & CRT. In VS2008 create a Win32 Console Application and write a simple hello world program deploy that program on the machine and you'll be sure that no Framework requirement is there, check the CRT you are linking with make it statically linked, in your case I think you are dynamically linking with CRT /MDd compiler switch MSVCRTD.dll which is the default option in VS2008. try using the /MTd or /MT which will link statically with your binary.

Install the microsoft Redistributable Package for your version (VS2008 in your case) on the machine, on which you are going to deploy the .exe. If you are using MFC then you either statically link with MFC or if you dynamically link with it then you must ship mfc with that.

Learn static and dynamic learning for more informaiton.


In any case you don't need to install the framework on the target machine if you are using the Native languages C/C++.

Hope this helps

First of all for all native Applications written in C/C++ no Framework is required, well as you are using MFC in your project I think you must know the basics of Dll & CRT. In VS2008 create a Win32 Console Application and write a simple hello world program deploy that program on the machine and you'll be sure that no Framework requirement is there, check the CRT you are linking with make it statically linked, in your case I think you are dynamically linking with CRT /MDd compiler switch MSVCRTD.dll which is the default option in VS2008. try using the /MTd or /MT which will link statically with your binary.

Install the microsoft Redistributable Package for your version (VS2008 in your case) on the machine, on which you are going to deploy the .exe. If you are using MFC then you either statically link with MFC or if you dynamically link with it then you must ship mfc with that.

Learn static and dynamic learning for more informaiton.


In any case you don't need to install the framework on the target machine if you are using the Native languages C/C++.

Hope this helps

Well, thanks for the prompt reply Ahmed, but, tell you what, I had statically linked all features of MFC before deploying... And, as I told you, the simple programs I did before used none other than native C Language. Even these simple programs needed .NET Framework. I have tried it before and googling for the error encountered when trying to run my file on a freshly installed OS, was that of not having .NET Framework. There were 2 errors encountered actually. One was that of vcredist, and the other was of .NET Framework. I don't really remember what error it was, but I am sure I had got one...

If I am wrong somewhere, please correct me...

Thanks again Ahmed...

BTW, I have also linked to CRT libraries statically. (Forgot to mention in previous post!).

As I said before, the problem is not linking to libraries or WinSxS, but clearly of .NET Framework, as just now, I tested it on another PC which did not have .NET Framework 3.5. I made the project for .NET Framework 2.0 and it worked as that PC was installed woth 2.0 and none of the later versions was installed...

*Bump*

Can anybody help me here a bit please...
(My best tutor here - Ancient Dragon, please help me sir...)

I am not using any features of .NET as I know of. So, why does Visual Studio always ask me to target a Framework in my project.

Make sure you do not have the /clr switch anywhere in your compiler command line options. C++/CLI compiles native C++ to a CLR assembly, so you might be targeting .NET without knowing it. I think /clr is a default switch for empty projects, if that is how you started.

commented: Thanks buddy +1

Install the Redistributables and your program should be ok. Also read this article carefully.

Thanks for the reply, but, that is what I did... I mean, I had MSDN installed on my PC and the deployment procedures where mentioned. I tried deploying on another PC, and it didn't work for "Target" platform 3.5. I will check again, by installing VMware Player tomorrow and do the needful...

Make sure you do not have the /clr switch anywhere in your compiler command line options. C++/CLI compiles native C++ to a CLR assembly, so you might be targeting .NET without knowing it. I think /clr is a default switch for empty projects, if that is how you started.

I have double checked CLR switch, and it was not switched on by default as I started Empty Win32 project...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.