Framework porting - General Discussion (2024)

Framework porting - General Discussion (1)&nbspFramework porting - General Discussion (2)
Framework porting - General Discussion (3)Framework porting - General Discussion (5)Framework porting - General Discussion (7)Framework porting - General Discussion (9)Framework porting - General Discussion (11)Framework porting - General Discussion (13)
Framework porting - General Discussion (15)

Jump to content

  • Sign In
  • Create Account
  • View New Content
  • Forums
  • Members
  • Chat
  1. Netduino Forums
  2. General
  3. General Discussion

The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

");//]]>

Started by NeonMika / Markus VV., Oct 27 2011 06:43 PM


  • Please log in to reply

5 replies to this topic

#1NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • Framework porting - General Discussion (19)Framework porting - General Discussion (20)Framework porting - General Discussion (21)
  • 209 posts
  • LocationUpper Austria

Posted 27 October 2011 - 06:43 PM

Hey folks,I'm facing a new problem. I have a library, created for "normal" .Net.Now I want to use this library in an .NETMF project and I get the warning message "The project 'NeonMika.Config' cannot be referenced. The referenced project is targeted to a different framework family (.NETFramework)"I expected that and thougt i just could change the framework in the properties page, but this is not working (just can choose from different .Net versions, not .NETMF)In one sentence: Is there an easy way to use an .Net libaray? Framework porting - General Discussion (22)Greets, Markus

    NeonMika.Webserver
    > Control your N+ and write webservice methods easyily
    > Receive data from you N+ (in XML or JSON)
    > Browse the SD on your N+ directly in the browser and d
    own - and upload files

    If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype Framework porting - General Discussion (23)

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    --- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

    • Back to top

    #2xprment626

    xprment626

      New Member

    • Members
    • Framework porting - General Discussion (26)
    • 6 posts

      Posted 27 October 2011 - 07:42 PM

      Hey folks,

      I'm facing a new problem. I have a library, created for "normal" .Net.
      Now I want to use this library in an .NETMF project and I get the warning message "The project 'NeonMika.Config' cannot be referenced. The referenced project is targeted to a different framework family (.NETFramework)"
      I expected that and thougt i just could change the framework in the properties page, but this is not working (just can choose from different .Net versions, not .NETMF)
      In one sentence: Is there an easy way to use an .Net libaray? Framework porting - General Discussion (27)

      Greets, Markus

      Edit: I guess I should ask, do you have sources for this library? If not, ignore everything below :-)

      I don't currently have access to a CF project file, but I don't think that there is an automatic way to do this so you might need to manually change the project file to include the appropriate targets, versions, etc. Once you have that building, you will most likely have a bunch of build errors as a result of using methods/classes that may only exist in big .NET which you can fix as you find them. I would use '#if CF' for the fixes so that the project is preserved for big .NET too and makes maintenance easier. I believe you can also conditionally include references/files in the project file (e.g., <Include condition=" '$(someCFIndicator)' = 'true'>MyCFFile.cs</Include>). If I get time tonight I will play around with this and see if I can help some more.

        • Back to top

        #3NeonMika / Markus VV.

        NeonMika / Markus VV.

          Advanced Member

        • Members
        • Framework porting - General Discussion (30)Framework porting - General Discussion (31)Framework porting - General Discussion (32)
        • 209 posts
        • LocationUpper Austria

        Posted 27 October 2011 - 08:01 PM

        Edit: I guess I should ask, do you have sources for this library? If not, ignore everything below :-)

        I don't currently have access to a CF project file, but I don't think that there is an automatic way to do this so you might need to manually change the project file to include the appropriate targets, versions, etc. Once you have that building, you will most likely have a bunch of build errors as a result of using methods/classes that may only exist in big .NET which you can fix as you find them. I would use '#if CF' for the fixes so that the project is preserved for big .NET too and makes maintenance easier. I believe you can also conditionally include references/files in the project file (e.g., <Include condition=" '$(someCFIndicator)' = 'true'>MyCFFile.cs</Include>). If I get time tonight I will play around with this and see if I can help some more.

        Yes, i have the source code, and it's not very big, but i'm just interested Framework porting - General Discussion (33)
        I know that i just could create a netduino project, copy the cs files into this directory, add this files to the project and compile it. But from this moment on, i would have to maintaince 2 projects (.net and netmf) doing exactly the same...
        It would be great if you can give me more information about "manually changing the project file"... Or about this topic in general. I hope you find somd time tonight Framework porting - General Discussion (34)
        But already thanks for your help Framework porting - General Discussion (35)

          NeonMika.Webserver
          > Control your N+ and write webservice methods easyily
          > Receive data from you N+ (in XML or JSON)
          > Browse the SD on your N+ directly in the browser and d
          own - and upload files

          If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype Framework porting - General Discussion (36)

          -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
          --- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
          -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

          • Back to top

          #4Chris Walker

          Chris Walker

            Secret Labs Staff

          • Moderators
          • Framework porting - General Discussion (39)
          • 7767 posts
          • LocationNew York, NY

          Posted 27 October 2011 - 08:20 PM

          We have a lot of libraries (10,000's or 100,000's of lines code) which we build for .NET MF, .NET CF, and .NET. The .NET CF and .NET assemblies are often one-and-the same, but I find that we end up P/Invoking quite a bit and build "helper" libraries to fill in missing features in .NET CF...so we tend to build multiple projects for simplicity sake.In theory, you should be able to build one project and switch between configurations to build it for .NET MF vs. .NET. Assuming that Visual Studio understands how to target different frameworks for different project configurations. Very interesting indeed.Chris

            • Back to top

            #5xprment626

            xprment626

              New Member

            • Members
            • Framework porting - General Discussion (42)
            • 6 posts

              Posted 27 October 2011 - 08:31 PM

              We have a lot of libraries (10,000's or 100,000's of lines code) which we build for .NET MF, .NET CF, and .NET.

              The .NET CF and .NET assemblies are often one-and-the same, but I find that we end up P/Invoking quite a bit and build "helper" libraries to fill in missing features in .NET CF...so we tend to build multiple projects for simplicity sake.

              In theory, you should be able to build one project and switch between configurations to build it for .NET MF vs. .NET. Assuming that Visual Studio understands how to target different frameworks for different project configurations. Very interesting indeed.

              Chris

              You could create different configurations and condition on that configuration.

              <Import condition=" '$(Configuration)' != 'CF' " Project="Microsoft.Common.Targets" /><Import condition=" '$(Configuration)' == 'CF' " Project="Microsoft.CompactFramework.Common.Targets" />

              and include any special files and references similarly. I think you'd have to code this up manually at first. I've mostly seen people creating separate project files, but the conditional approach should work.

              Again, if I have time tonight, I'll try to create a template (not of the VS variety) for this.

                • Back to top

                #6xprment626

                xprment626

                  New Member

                • Members
                • Framework porting - General Discussion (45)
                • 6 posts

                  Posted 28 October 2011 - 04:11 AM

                  Ok, this is very rough, but joining both types of projects, you get something like the code below. You will have to tweak it as you go, but I think this demonstrates the point. The advantage of maintaining two project files is that you get better tooling support.

                  <?xml version="1.0" encoding="utf-8"?><Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup Label="Common Properties"> <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <RootNamespace>MyLibrary</RootNamespace> <AssemblyName>MyLibrary</AssemblyName> <OutputType>Library</OutputType> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{340BCCC0-3F98-40E7-8DBD-181954F999F2}</ProjectGuid> <AppDesignerFolder>Properties</AppDesignerFolder> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Label="CF Properties" Condition=" '$(Configuration)|$(Platform)' == 'CompactFramework|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <OutputPath>bin\CompactFramework\</OutputPath> <TargetFrameworkVersion>v4.1</TargetFrameworkVersion> <ProductVersion>9.0.21022</ProductVersion> <ProjectTypeGuids>{b69e3092-b931-443c-abe7-7e7b65f2a37f};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <NetMfTargetsBaseDir Condition="'$(NetMfTargetsBaseDir)'==''">$(MSBuildExtensionsPath32)\Microsoft\.NET Micro Framework\</NetMfTargetsBaseDir> </PropertyGroup> <PropertyGroup Label="dotNET Properties" Condition=" '$(Configuration)' != 'CompactFramework' "> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <ProductVersion>8.0.30703</ProductVersion> <FileAlignment>512</FileAlignment> </PropertyGroup> <Import Condition=" '$(Configuration)' == 'CompactFramework' " Project="$(NetMfTargetsBaseDir)$(TargetFrameworkVersion)\CSharp.Targets" /> <ItemGroup Label="Common References"> </ItemGroup> <ItemGroup Label="Common Files"> <Compile Include="MyClass.cs" /> </ItemGroup> <ItemGroup Condition=" '$(Configuration)' != 'CompactFramework' "> <Compile Include="NET.cs" /> </ItemGroup> <ItemGroup Condition=" '$(Configuration)' == 'CompactFramework' "> <Compile Include="CF.cs" /> </ItemGroup> <Import Condition=" '$(Configuration)' != 'CompactFramework' " Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /></Project>

                    • Back to top

                    Back to General Discussion



                    0 user(s) are reading this topic

                    0 members, 0 guests, 0 anonymous users

                    1. Netduino Forums
                    2. General
                    3. General Discussion
                    4. Privacy Policy

                    Framework porting - General Discussion (48)

                    Framework porting - General Discussion (49)Framework porting - General Discussion (50)
                    homehardwareprojectsdownloadscommunitywhere to buycontactCopyright © 2016 Wilderness Labs Inc.| Legal&nbsp| Framework porting - General Discussion (51)
                    Framework porting - General Discussion (52)Framework porting - General Discussion (53)This webpage is licensed under a Creative Commons Attribution-ShareAlike License.Framework porting - General Discussion (54)Framework porting - General Discussion (55)
                    Framework porting - General Discussion (2024)

                    References

                    Top Articles
                    Latest Posts
                    Article information

                    Author: Dr. Pierre Goyette

                    Last Updated:

                    Views: 6015

                    Rating: 5 / 5 (50 voted)

                    Reviews: 89% of readers found this page helpful

                    Author information

                    Name: Dr. Pierre Goyette

                    Birthday: 1998-01-29

                    Address: Apt. 611 3357 Yong Plain, West Audra, IL 70053

                    Phone: +5819954278378

                    Job: Construction Director

                    Hobby: Embroidery, Creative writing, Shopping, Driving, Stand-up comedy, Coffee roasting, Scrapbooking

                    Introduction: My name is Dr. Pierre Goyette, I am a enchanting, powerful, jolly, rich, graceful, colorful, zany person who loves writing and wants to share my knowledge and understanding with you.