Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

Preventing usage of .NET features in VS .NET 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Senapathy - 03 Mar 2005 12:52 GMT
Hi,

We are in the process of migrating from VS 6.0 to VS .NET 2003.
Our code base in VS 6.0 is mainly C++.
As a first step we do _not_ want to use the .NET framework features, but
just continue to use unmanaged C++ code. We are only looking to use the more
standard-compliant C++ compiler, usage of Boost libraries etc.

Is there any way to disable / prevent the usage (intentional / deliberate)
of any .NET features? By features, I mean some new headers / controls / APIs
available only with VC7.

Say, some compiler switches, preprocessor definitions etc? Googling did not
help me much...

Regards,
Sena
Antti Keskinen - 03 Mar 2005 12:56 GMT
Hello !

VS .NET 2003 does not integrate with .NET Framework unless you create an
application that exclusively uses the framework. For example, if you create
a standard Win32 application with it, it will not include any .NET stuff by
default. The only thing it might do is include the MFC component (if you
specify it to do that), but no .NET as default.

To create a .NET application in VS .NET 2003, you'd need to either create a
C# project (which .NET-only) or reference the .NET libraries from a C++
application.

-Antti Keskinen

> Hi,
>
[quoted text clipped - 16 lines]
> Regards,
> Sena
Nemanja Trifunovic - 03 Mar 2005 13:55 GMT
In order to make a .NET application from VC++, you must use compiler
switch /clr That will instruct the compiler to produce IL rather than
machine code.
Carl Daniel [VC++ MVP] - 03 Mar 2005 14:40 GMT
> Hi,
>
[quoted text clipped - 11 lines]
> Say, some compiler switches, preprocessor definitions etc? Googling
> did not help me much...

Don't compile with /clr and you can't use any .NET features.  Simple.

-cd
Senapathy - 03 Mar 2005 14:48 GMT
Hello group,

Thanks Antti, Nemanja and Carl ! The answer seems to be simple !

Now I just need to figure out a way such that no developer uses the /clr
option - either by mistake or intentionally. ( I am thinking from the
central production point of view and we have many developers checking in
sources and project files ). I am sure that for this, there will be some
simple means by which I can flag a production time error if someone uses the
/clr option - I can't seem to recollect any method just off my head, but I
think I can find that out.

Thanks for the help!

Regards,
Sena

> > Hi,
> >
[quoted text clipped - 15 lines]
>
> -cd
Arnaud Debaene - 03 Mar 2005 19:21 GMT
> Hello group,
>
[quoted text clipped - 5 lines]
> error if someone uses the /clr option - I can't seem to recollect any
> method just off my head, but I think I can find that out.

I don't know of any source control system that would do so complex
verifications on check-in. Developpers are supposed to be responsible
people, so threatening to fire anyone who use /clr should be enough :-)
More seriously, if you have dedicated test machines, do *not* install the
.NET framework on them. This way, the .NET programs won't be able to run on
them.

Arnaud
MVP - VC
Steve McLellan - 04 Mar 2005 16:40 GMT
There's a preprocessor definition _MANAGED that is set under a CLR
compilation (if memory serves), so you could check for that. My guess is
you'd get a lot of other compile errors in a complex project.

Steve

> Hello group,
>
[quoted text clipped - 33 lines]
>>
>> -cd
adebaene@club-internet.fr - 03 Mar 2005 16:06 GMT
> Hi,
>
[quoted text clipped - 6 lines]
> Is there any way to disable / prevent the usage (intentional / deliberate)
> of any .NET features?
If you do not compile with /clr, the C++ compiler will produe native
code, not .NET IL and will refuse any managed C++ construct.

> By features, I mean some new headers / controls / APIs
> available only with VC7.
I think you confuse 2 things : There is on one side all the .NET stuff
you can avoid by not using the /clr compiler switch.

On the other hand, VC 2003 also adds new unmanaged functionnalities
(for example, MFC and ATL have evolved, the STL if far more compliant,
etc...) You have no way to disable those new features, but you have no
reason to want to avoid them in the first place.

Arnaud
MVP - VC
Serge Baltic - 03 Mar 2005 17:06 GMT
S> We are in the process of migrating from VS 6.0 to VS .NET 2003.
S> Our code base in VS 6.0 is mainly C++.
S> As a first step we do _not_ want to use the .NET framework features,
S> but
S> just continue to use unmanaged C++ code. We are only looking to use
S> the more
S> standard-compliant C++ compiler, usage of Boost libraries etc.
S> Is there any way to disable / prevent the usage (intentional /
S> deliberate) of any .NET features? By features, I mean some new
S> headers / controls / APIs available only with VC7.

As you wish to use the new compiler, it will inevitably use the new headers
and APIs "available only with VC7". But VC7 on its own has nothing to do
to .NET (unless you explicitly allow using .NET features in the project properties).
So just do not turn on any options for "Managed", CLI/CLR, C#, etc, and that
will be it.

Signature

Serge


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.