Sharing between projects
-
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
-
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
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.
-
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
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
-
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
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
-
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
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.