Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - Code compiler for .NET & CF.NET

I've a same project that need to be compiled with .NET and Compact .NET Framework.

  1. It is possible to create a C# compiler that will compile my project with both framework ?
  2. Some feature aren't present in CF.NET Framework so I created it by myself (creating classes having exactly the same name & options that in .NET Framework. If I decore this classes with an attribute like [CF35] it's possible to parse the project and :

    • Use this class when compile the project using CF.NET
    • Ignore this class when compile the project using .NET

?

Thanks for all constructive answers.

[EDIT]

I know the solution that consists to create two projects referencing the same files. Problem is, you should every time compile both manually. Moreover, when you add a file to one, you need to open the second and reference it too, that it's just borring to do and according that we are many people to work on the same project, I would like to do this part automatically.

Seems to be possible?


[EDIT 2] All works fine except ... resources files !

So, to resume, I've three project :

  • the development project (CF.NET)
  • the release project (CF.NET 3.5), including all files via ""
  • the release project (NET 3.5), including all files via ""

As said, all works fine, but now my problem is using Resources files.

What's the method to apply to use it?

  • When I use the development project, Resource file is correctly retrieved
  • When I use the two other projects, ResourceManager throws MissingManifestResourceException

Any idea?

like image 223
Arnaud F. Avatar asked Dec 04 '22 09:12

Arnaud F.


1 Answers

You'll need to create different build configurations for each and define a custom flag like USE_CF. Then wrap your custom classes with #if USE_CF and #endif so they get ignored when compiling without that flag

like image 154
Robert Levy Avatar answered Dec 24 '22 11:12

Robert Levy