Reusing code in standard and compact framework

J

John O'Neill

Hi

I am writing a class to interpret the contents of an xml file using
System.Xml.XmlReader and want to use the same class in a desktop application
which uses the .net standard framework and also on a pocket pc that uses the
..net compact framework.

When deploying to a desktop app, System.Xml.XmlReader is found in
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Xml.dll and when
deploying to a pocket pc app, System.Xml.XmlReader is found in C:\Program
Files\Microsoft Visual Studio .NET
2003\CompactFrameworkSDK\v1.0.5000\Windows CE\System.XML.dll

At the moment I have created 2 projects; a windows desktop application
project and a smart device application project. Both projects have exactly
the same code in them, the only difference is that one of them uses a
reference to System.Xml.dll for the .net standard framework and the other
uses a reference to System.Xml.dll for the .net compact framework.

Is there another way I can do this without duplicating my code for both
platforms?

My next task is to somehow create a custom control that works on both
platforms without having to duplicate my code again!

Thanks

John
 
Y

Yan-Hong Huang[MSFT]

Hi John,

Based on my understanding, now the question is: You are developing an
application on both desktop platform and compact platform. However, the
XML.dll path of XMLReader is different on these two platfroms. So you need
to create two projects now. Your question is that whether there is any way
to create only one project to accomplishi it, right?

Firstly, VS.NET IDE is a RAID tool for developing. So many of its work can
be done in visual studio command prompt too. For this question, if we are
using different DLLs in these 2 projects, it is impossible for us to create
just one project in VS.NET to make it refer to different DLLs on different
platform.

If you only want a copy of source code, I think you may need to use command
link compiler csc.exe with paramters to refer to different DLLs, just like
makefile in VC world. However, that need some more work.

For your next task, "creating a custom control for both platforms", I don't
think that is possible unless you build it with different version of DLLs.

Besides, we can also keep a copy of source in source control and then check
out it to project each time. In this way, we can keep source in a centrol
place.

Does that answer your question? If there is any unclear, please feel free
to post here.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

John O'Neill

I did wonder about using source control to accomplish this. I think I will
give it a try.

Thanks for your help.

John
 
Y

Yan-Hong Huang[MSFT]

Hi John,

You are welcome. Based on my understanding, your main concern is to keep
source in a central place. That is why I suggest that to you. Source
control is mostly used for team development and hope it helps.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top