Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# - Sharing assembly between projects?

C# - Sharing assembly between projects?

Scheduled Pinned Locked Moved C#
csharpquestionvisual-studiowinformshelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wbjohnson
    wrote on last edited by
    #1

    Hi all, I have a little problem.... I have a C# Winforms app that sends serialised data to a Pocket PC via TCP/IP, the transmission isnt the problem, but the library Objects.dll was built as a windows library, and even though they are simple objects Visual Studio 2005 wont let me add the project reference to the Pocket PC application because its not a Smart Device Library.... How can i get round this problem? Ideally i want one single assembly that will work for both Winforms and PocketPC client (.net2), using vs2005 Cheers guys! Will

    P 1 Reply Last reply
    0
    • W wbjohnson

      Hi all, I have a little problem.... I have a C# Winforms app that sends serialised data to a Pocket PC via TCP/IP, the transmission isnt the problem, but the library Objects.dll was built as a windows library, and even though they are simple objects Visual Studio 2005 wont let me add the project reference to the Pocket PC application because its not a Smart Device Library.... How can i get round this problem? Ideally i want one single assembly that will work for both Winforms and PocketPC client (.net2), using vs2005 Cheers guys! Will

      P Offline
      P Offline
      Patrick Etc
      wrote on last edited by
      #2

      Hi Will, Create a new Smart Device (PDA) class library project in your solution. Right-click the project and select Add->Existing Items. Navigate to the directory that contains your library files, and select them. In the navigation window, rather than clicking the "Add" button, click the small dropdown arrow on the side of the "Add" button. It will show a menu that says "Add as Link." Select that option. You'll see the files show up in your project with small shortcut icons attached to them. When you compile this project, it will compile the files using the Compact Framework compiler to this Smart Device project's output directory (not to the original WinForms project's directory). This way, you have two separate projects with the same source files, that will compile to their respective target frameworks. Making edits in the files will show up in both projects. NOTE: If you open the files from the desktop project, you will get Intellisense for the full framework. If you open the files from the PDA project, you will get Intellisense for the Compact Framework. Even though it is exactly the same files, Visual Studio will determine which editing environment to use based on which project opened the files. ALSO: If you need code specific to either framework, define a symbol in your Compact Framework project properties that you can use for #if..#endif pragmas. This way you can add custom code for each framework that won't interfere with the compiled code in the other framework. For example: Say you define a symbol "NET_CF" in your Compact Framework project. In your code you can do something like this: #if NET_CF ... CF code... #else ... Desktop code... #endif Hope this helps


      The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee

      W 1 Reply Last reply
      0
      • P Patrick Etc

        Hi Will, Create a new Smart Device (PDA) class library project in your solution. Right-click the project and select Add->Existing Items. Navigate to the directory that contains your library files, and select them. In the navigation window, rather than clicking the "Add" button, click the small dropdown arrow on the side of the "Add" button. It will show a menu that says "Add as Link." Select that option. You'll see the files show up in your project with small shortcut icons attached to them. When you compile this project, it will compile the files using the Compact Framework compiler to this Smart Device project's output directory (not to the original WinForms project's directory). This way, you have two separate projects with the same source files, that will compile to their respective target frameworks. Making edits in the files will show up in both projects. NOTE: If you open the files from the desktop project, you will get Intellisense for the full framework. If you open the files from the PDA project, you will get Intellisense for the Compact Framework. Even though it is exactly the same files, Visual Studio will determine which editing environment to use based on which project opened the files. ALSO: If you need code specific to either framework, define a symbol in your Compact Framework project properties that you can use for #if..#endif pragmas. This way you can add custom code for each framework that won't interfere with the compiled code in the other framework. For example: Say you define a symbol "NET_CF" in your Compact Framework project. In your code you can do something like this: #if NET_CF ... CF code... #else ... Desktop code... #endif Hope this helps


        The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee

        W Offline
        W Offline
        wbjohnson
        wrote on last edited by
        #3

        that is spot on! thanks for your time dude! Cheers Will

        P 1 Reply Last reply
        0
        • W wbjohnson

          that is spot on! thanks for your time dude! Cheers Will

          P Offline
          P Offline
          Patrick Etc
          wrote on last edited by
          #4

          I had to do the same thing recently. :) Glad I could help :)


          The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups