cab files with #if (!COMPACT)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My app uses C# classes that are shared with other apps that are Full
Framework. Therefore, I have several places where I have #if (!COMPACT) in
order to allow for methods and variables for the full framework. It works
fine when I am in debug, but it will not allow me to even create the cab
files in Release mode.

This is causing a problem when trying to create the Custom Installer,
described by this article:
http://msdn.microsoft.com/smartclie...rary/en-us/dnnetcomp/html/netcfdeployment.asp

Does anyone have any experience with this and know away around it or a way
to fix it without having to remove all of the FF code requiring the "#if"
statements?

Thanks
-G
 
Hi,

I have worked on this extensively, I also used many conditional compilation
statements in my app when I generate a cab file I haven't faced any problem.

Can you please explain me in detail, what are you doing in ur code.

Regards
Mahesh
 
Mahesh,

There are about 8 projects in my solution. 6 of the 8 are shared with other
apps that work under the full framework. Some of the classes include
controls or methods that are just not supported in CF.

We are using MS Visual Source Safe for source control. The projects that
need to be shared by both frameworks are set up so that there are actually
two locations for the projects. For instance, if there was a project under
the Desktop Framework called points, we also have a project in a different
location called points-cf. The classes are simply shared through Source Safe
so that there is really only one file and when you change the file while
working under CF, you have to get latest version of that file to get the
changes under the Desktop Framework.

I know there are easier ways to do the above sharing, but the boss is
worried about files getting deleted completely when a person just means to
delete the file from the current project.

That is the basis of how the code is being shared. In the code, it is
fairly straightforward. If there is a method that is needed by both the
Desktop Framework app and the CF app and the function is supported under
both, there is nothing necessary. However, if a method has to be changed to
support one framework or ther other, the directives are used.

For example, we have a class that uses a stack for methods in the Desktop
Framework. However, that functionality is not necessary for our CF app. So,
those methods were surrounded using #if (!COMPACT). So the class looks
something like this:

public class StackClass
{
#if (!COMPACT)

public void StackMethod()
{
....stuff using stacks
}

#endif
}

Everything is fine as long as I'm in debug, but when I change it over to
Release it does not recognize those directives.

I have something similar for our serialization routines:

public bool Save(string file)
{
#if (!COMPACT)
// Call method for Full Framework
SerializeObject(file);
#else
// Call method for CF
ObjectToXml(file);
#endif
}

Again, this only works in debug mode.

Do you have any suggestions??

Thanks for your help.

-G
 
Hi,

We used NANT to compile our projects, during our nant build we pass a
parameter say (.NET CF) based on this parameter all our projects will be
compiled.

Regards
Mahesh
 
Back
Top