Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3999880
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:42:46+00:00 2026-05-20T07:42:46+00:00

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

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:42:47+00:00Added an answer on May 20, 2026 at 7:42 am

    The basic idea would be to decorate your code with #if compiler directives for each framework version?

    #if CFNET
    // .net CF code
    #else
    // .net code
    #endif
    

    From here one you have two options:

    A) 1 project file with custom build configurations

    If you would like to have everything in 1 csproj file you’ll need to modify it manually. Since this is a msbuild file this is more of a msbuild problem. I figure you would need to do the following things:

    1. Use 2 platform names say “NET” and “CF” (instead of the default Any CPU or x86)
    2. Define CF constant (From now on Edit csproj):

      <PropertyGroup Condition="'$(Platform)' == 'CF'">
      <DefineConstants>CF</DefineConstants>
      </PropertyGroup>

    3. Import correct build targets depending on selected platform:

      <Import Condition="'$(Platform)' == 'NET'" Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
      <Import Condition="'$(Platform)' == 'CF'" Project="$(MSBuildToolsPath)\<CFtargets>.targets" />

      I don’t know the targets file name of CF since I don’t have it installed. It sould be somewhere in C:\Windows\Microsoft.NET\**.targets

    B) 2 project files each containing the appropriate build configuration

    As I initially pointed out, and also some commenter pointed out, the best solution is to have 2 project files, that you keep in sync. You can have the same source files in both project files.

    So an idea would be (instead of copying the file list manually each time) to

    1. think about using T4 templates, to keep the source files in sync (and have 2 solutions, so you wouldn’t be prompted to reload the whole solution each time) or to
    2. modify the two csproj files and use a wildcard compile tag like this:

      <Compile Include="**/*.cs"/>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.