Вопрос

we have an ASP.NET web forms w/ VB code-behind intranet "web site" project. It is time to split this out a bit as we have Intermec scanners that now need to use them. My idea is to have 3 separate "web sites" all under the same solution. 1 will be our main site. 2 will be the scanner or "mobile" site. 3 will be ajax WCF services. I wanted to see if this seems like a logical set up and if so; what is the best way to share code between the web sites. Ideally, most of our app code will eventually in the services web site. But this will take time to switch it over. Until then I need to be able to share calls thru all three of the sites.

I swore I read that I could just "Import" the app code file (since it is all in the same solution) and I would have access to the code.

Thanks! Josh

Это было полезно?

Решение

The solution we came up with was to add a new class library to our solution. This keeps the web site project separate and then we added a reference to our website pointing to the class library. We slowly are move the App Code from the website to the class lib, importing the necessary namespaces to the class library as needed.

Другие советы

Sorry, but I don't know of a Import Code mechanism; the closest I can imagine is to add links to the files in the Add Existing Item dialog. The file is not copied to the new project but linked, so any code change in the file influences all projects that the file is added to. It is an easy, but not a really clean approach. There is not a good separation between the projects and one can safely expect more harm than good through this. Developers would not be aware that they might break another project when they are editing a file.
A better approach is to add a class library project to your solution, move the code there and reference the class library from the other projects. This way you can access the functionality and still have a good separation between the projects.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top