views:

392

answers:

3

Scenario:

Let's say I have four very similar applications (i.e. most of the functionality is the same, but they are different enough to justify each being seperate applications).

What is the best way to re-use the common functionality code between them? COM+? Web services?

In general I'd typically just have the code in a seperate project (dll), but anytime that's updated, the file has to be updated for each ASP.Net application, and wasn't sure if there was a better way of going about it.

Thanks!

+2  A: 

If all the apps are on the same virtual server, consider placing the shared assembly in the GAC. This allows you to diverge versions should the need arise, and keeps everything in the same place as a bonus. Downsides: this assembly runs with full trust and you should use policy and CAS to ensure there are no elevation of trust leverage points for external untrusted assemblies. You'll also need to learn about the [AllowPartiallyTrustedCallers] attribute.

As for the other choices, COM+, meh, a bit heavyweight. Good for transactional stuff. Web services, not so good for data heavy services, but if done right, can be fairly maintainable. The more it's shared, the better the pay off.

x0n
+4  A: 

If possible, you can create a Visual Studio solution with a DLL Project and a number of Web Application or Website projects. The web projects would have a "project" type reference to the DLL project, and everything would build at the same time. Then you could use the "Publish" tool for each of your web projects as needed.

Barry Fandango
+1  A: 

You can have your project, but instead of adding the common dll to the project reference add the common project to all solutions and then add a reference to the common project.

This way you can have one project on any number of solutions and you have your problem solved ;)

Sergio
Yeah, but each project referencing the DLL may still need to be recompiled unless each app using the DLL has thier own copy of the DLL.
John MacIntyre