I recently worked on a secondary development of an ASP. NET 2.0 project.CodeAfter compilation, an error is reported: The system has imported the same simple name "app_code, version = 0.0.0.0, culture = neutral, publickeytoken = NULL"ProgramSet. Try to remove one of the references or add a signature to the reference to enable parallel mode. It turns out that the app_code.dll has been compiled in the original project and referenced in the secondary development project. Therefore, the name conflict occurs during compilation. Try to directly put the app_code folder for secondary development in the folder of the Virtual Site. When you run the pre-compilation for the first time, the following error occurs: The application has been pre-compiled, therefore, the directory "/website/app_code/" is not allowed /". It seems that you can only find a way to compile the shared code of secondary development into a DLL with other names.
Check it. NET 2005 documentation, found that the app_code folder can contain any number of files and subfolders, can still compile all the code into a single assembly, that is, app_code.dll, it seems that the DLL named after the folder name cannot be generated by the folder name. However, app_code has a feature that can be used in many ways.Programming LanguageWrite a custom class.Source codeTo compile the code into a single assembly, the code written in different languages must be placed in different subfolders, that is, the code in the same folder must be written in the same language, by configuring the web application, you can use the subfolders of the app_code folder as independent compilation units. Therefore, the generated dll must be a DLL independent of the programming language.
Create a code2nd sub-folder under the app_code folder of the project, move the shared code for secondary development to the sub-folder, and configure it in Web. config according to the sample code in the help document:
1 < Compilation debug = " False " >
2 < Codesubdirectories >
3 < Add directoryname = " Code2nd " />
4 </ Codesubdirectories >
5 </ Compilation >
The website is successfully generated. Go to the bin folder of the generated website directory and browse it. With a new DLL, the file name is app_subcode_code2nd.dll, it is obviously the DLL ^_^ generated by the code in the code2nd sub-folder.
In another test, two more folders are created under the app_code folder, and two simple test codes are written. One is generated successfully using C # And the other VB, this method can be used to split large DLL files and update some code blocks by updating the shared code of Web applications.