473,811 Members | 3,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Single source code to compile over .NET 1.0, 1.1, 2.0 and CF

Hi everyone,

I have a .NET 1.1 application ready to be ported on .NET 2.0.

With some of the features made obsolete in 2.0 and the new recomended
methods are not available in .NET 1.1, It leaved me with a question in mind:

How come I conditionally compile my application with .NET 1.1 and 2.0 ?

An example of obsolete method in 2.0 is:
//-------------------------------------------------------------------
// .NET 1.1: OK, .NET 2.0: Warning, Property
ConfigurationSe ttings.AppSetti ngs is obsolete !
string szNewKbAddr =
System.Configur ation.Configura tionSettings.Ap pSettings[AppConstant.KEY _NEW_K
B_ADDRESS];

// .NET 1.1: Error, .NET 2.0: OK
string szNewKbAddr =
System.Configur ation.Configura tionManager.App Settings[AppConstant.KEY _NEW_KB
_ADDRESS];
//-------------------------------------------------------------------
I have used the code block similar to below, for conditional compilation of
code for .NET 1.1 and .NET CF:
//-------------------------------------------------------------------
#if(_WIN32_WCE)
... ... .NET CF specific code ... ...
#else
... ... .NET 1.1 specific code ... ...
#endif
//-------------------------------------------------------------------

Do we have any solution, to either conditionally compile the single source
code application on different versions of .NET ( 1.1 and 2.0 ) ?
OR- any other solution please ?

Thanks ...

* (Vipul)() ;
Mar 10 '06 #1
2 1440
Vipul Pathak wrote:
Hi everyone,

I have a .NET 1.1 application ready to be ported on .NET 2.0.

With some of the features made obsolete in 2.0 and the new recomended
methods are not available in .NET 1.1, It leaved me with a question
in mind:

How come I conditionally compile my application with .NET 1.1 and 2.0
?

An example of obsolete method in 2.0 is:
//-------------------------------------------------------------------
// .NET 1.1: OK, .NET 2.0: Warning, Property
ConfigurationSe ttings.AppSetti ngs is obsolete !
string szNewKbAddr =
System.Configur ation.Configura tionSettings.Ap pSettings[AppConstant.KEY
_NEW_K B_ADDRESS];

// .NET 1.1: Error, .NET 2.0: OK
string szNewKbAddr =
System.Configur ation.Configura tionManager.App Settings[AppConstant.KEY _
NEW_KB _ADDRESS];
//-------------------------------------------------------------------
I have used the code block similar to below, for conditional
compilation of code for .NET 1.1 and .NET CF:
//-------------------------------------------------------------------
#if(_WIN32_WCE)
... ... .NET CF specific code ... ...
#else
... ... .NET 1.1 specific code ... ...
#endif
//-------------------------------------------------------------------

Do we have any solution, to either conditionally compile the single
source code application on different versions of .NET ( 1.1 and 2.0 )
? OR- any other solution please ?

Thanks ...


Create nmake files and pass a define, like NET20. In the source, you
place
#if NET20
//... .net 20 specific
#endif
#if NET11
//... .net 11 specific
#endif

statements.

Example: (makefile_20)
SOURCES=Assembl yInfoDotNet20.c s DynamicQueryEng ine.cs
SqlServerSpecif icCreator.cs

REFERENCES=SD.L LBLGen.Pro.ORMS upportClasses.N ET20.dll
REFDIR=..\ORMSu pportClasses\Do tNET2.0\bin\

all : $(SOURCES)
csc /t:library
/out:DotNET2.0\b in\SD.LLBLGen.P ro.DQE.SqlServe r.NET20.dll
/doc:DotNET2.0\b in\SD.LLBLGen.P ro.DQE.S
qlServer.NET20. xml /d:TRACE,DOTNET2 0 /o /lib:$(REFDIR) /r:$(REFERENCES)
$(SOURCES)

debug : $(SOURCES)
csc /t:library /debug
/out:DotNET2.0\b in\SD.LLBLGen.P ro.DQE.SqlServe r.NET20.dll
/d:TRACE,DEBUG,D OTNET20 /lib:$(R
EFDIR) /r:$(REFERENCES) $(SOURCES)

clean:
del /Q DotNET2.0\bin\S D.LLBLGen.Pro.D QE.SqlServer.NE T20.*
and I start this with a simple .cmd file:
mkdir DotNET2.0\bin
nmake /nologo /f makefile_20 clean
nmake /nologo /f makefile_20

Frans

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Mar 10 '06 #2

"Vipul Pathak" <vpathak_[RemoveThisPart]_@impetus.co.in > wrote in message
news:OR******** ******@TK2MSFTN GP12.phx.gbl...
Hi everyone,

I have a .NET 1.1 application ready to be ported on .NET 2.0.

With some of the features made obsolete in 2.0 and the new recomended
methods are not available in .NET 1.1, It leaved me with a question in
mind:

How come I conditionally compile my application with .NET 1.1 and 2.0 ?


Obsolete doesn't mean that they wont work.

I would just use the obsolete methods and ignore the warnings - you are less
likely to get version specific bugs that way.
Mar 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2953
by: LP | last post by:
Hi, I have a site which runs on .Net technology. The site is already deployed and running. I need to change 1 file for some small enhancement. Please tell me, how can I compile that 1 file and merge it to the original DLL (the one deployed on the live server) so as to upgrade it. I dont want to recompile the whole project for the 1 file Regards,. LP
10
2319
by: Tim Mulholland | last post by:
My company is about to begin working on an ASP.NET application. There are going to be two primary developers working on this project. It will be a fairly deep project (lots of lines of code) but not a very wide project (pretty much limited to a few purposes, not many ways to split it up). I've done alot of ASP.NET development before by myself so writing the application shouldn't be an issue, but my question is this: How do multiple...
3
336
by: LP | last post by:
Hi, I have a site which runs on .Net technology. The site is already deployed and running. I need to change 1 file for some small enhancement. Please tell me, how can I compile that 1 file and merge it to the original DLL (the one deployed on the live server) so as to upgrade it. I dont want to recompile the whole project for the 1 file Regards,. LP
3
2081
by: Claudio Pacciarini | last post by:
Hi everyone, I have a question about .NET code sharing and reuse, and also about application design best practices / guidelines. Currently, we have many different .NET projects in source depot. Although they are different, in some of them we share C# code by referencing source files that are external (not part of the projects) on each project. For instance, some of our projects have the typical “sources” file with:
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10384
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10395
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10130
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6887
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4338
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.