Issues with the App_code folder
I created an application which is using classes from App_Code.
I have no开发者_如何转开发w added this application as a subfolder to an existing application. So there are App_Code now one in the root and one in the sub-folder.
I want to find out how do I make my app in the subfolder be able to recognize files kept in teh App_Code of the subfolder.
I would consider moving all of your code out of App_Code (and the /OldProject/App_Code) folders and into a new Class Library Project. Put the code from OldProject into one namespace, and the code from NewProject into a different namespace (avoids the duplicate name problem). Then add references to the new project dll and namespace to the web app where appropriate (doing this will also enable you to Unit Test your code, something that is near impossible to do when the code is in App_Code).
It might be easier to go through website B's app_code folder and create a new namespace for these classes. Then move all of the files into one app_code folder so that everything gets complied down to one assembly during runtime. The framework should be able to figure things out at that time.
Hope this helps some.
I think that codeSubDirectories is used only when using C# and VB.NET in the same project. For ex. your website is in C# but in but you want to use also VB.NET code. This is valid only for websites though and not for web application projects.
using c# and vb in the same web project
But if for ex. WebsiteA is located in C:\inetpub\wwwroot\WebsiteA and you want the WebsiteB to have the location C:\inetpub\wwwroot\WebsiteA\WebsiteB then both WebsiteA and Website B should be configured as virtual directories in IIS.
If you were talking about sharing the same logic between applications, then you should wrap the whole logic in a class library and reference it to the projects.
精彩评论