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. Web Development
  3. ASP.NET
  4. Sharing between projects

Sharing between projects

Scheduled Pinned Locked Moved ASP.NET
5 Posts 3 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.
  • S Offline
    S Offline
    Sam Heller
    wrote on last edited by
    #1

    Is there any way of sharing resources from one project to another under the same solution. For instance a web.config file and it's properties or some classes and their methods. Thanks

    B C 2 Replies Last reply
    0
    • S Sam Heller

      Is there any way of sharing resources from one project to another under the same solution. For instance a web.config file and it's properties or some classes and their methods. Thanks

      B Offline
      B Offline
      Brent Lamborn
      wrote on last edited by
      #2

      For classes and methods you need to put them into a seperate assembly then add a reference to it in each of the projects. For config files, put settings that are common across all applications in the machine.config rather than the web.config.


      "Half this game is ninety percent mental." - Yogi Berra If you can read thank a teacher, if you can read in English, thank a Marine.

      1 Reply Last reply
      0
      • S Sam Heller

        Is there any way of sharing resources from one project to another under the same solution. For instance a web.config file and it's properties or some classes and their methods. Thanks

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        Sam Heller wrote:

        Is there any way of sharing resources from one project to another under the same solution. For instance a web.config file and it's properties or some classes and their methods.

        Yes. For code, you create class library projects (for the code you wish to share) and then you reference them in other projects. (Right click the project, then Add-->Reference... In the dialog pick from the list in the "Projects" tab) If you are using .NET 2.0 the visual studio resource editor will create a class wrapper to allow you access to the resources, this can be picked up like any other code. Default config files (e.g. web.config or app.config) are accessible from any code as they are deployed with the assemblies as a separate file.


        Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

        S 1 Reply Last reply
        0
        • C Colin Angus Mackay

          Sam Heller wrote:

          Is there any way of sharing resources from one project to another under the same solution. For instance a web.config file and it's properties or some classes and their methods.

          Yes. For code, you create class library projects (for the code you wish to share) and then you reference them in other projects. (Right click the project, then Add-->Reference... In the dialog pick from the list in the "Projects" tab) If you are using .NET 2.0 the visual studio resource editor will create a class wrapper to allow you access to the resources, this can be picked up like any other code. Default config files (e.g. web.config or app.config) are accessible from any code as they are deployed with the assemblies as a separate file.


          Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website

          S Offline
          S Offline
          Sam Heller
          wrote on last edited by
          #4

          Ok so any classes need to be in a seperate project and then this needs to be reference by the other projects. But what about the app.config file. I failed to mention that this solution is three seperate web services. At the moment they all have their own app.config file. This as you expect contains almost identical content. Thanks

          B 1 Reply Last reply
          0
          • S Sam Heller

            Ok so any classes need to be in a seperate project and then this needs to be reference by the other projects. But what about the app.config file. I failed to mention that this solution is three seperate web services. At the moment they all have their own app.config file. This as you expect contains almost identical content. Thanks

            B Offline
            B Offline
            Brent Lamborn
            wrote on last edited by
            #5

            If those web services all run on the same physical machine, then you can put those settings in the machine.config file on that machine to save from having to duplicate the settings in each app.config. Then of course, edit your own machine.config so the same settings apply on your development machine. Perhaps this will help: http://msdn2.microsoft.com/en-us/library/ms178685.aspx[^]


            "Half this game is ninety percent mental." - Yogi Berra If you can read thank a teacher, if you can read in English, thank a Marine.

            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