Web Site Projects, Project References, and Version Control
I have an ASP.NET Web Site project that used to have it's logic in the App_Code folder. I pulled some of the code into a Class Library project (to allow unit testing) and added a Project Reference. It compiles and runs fine.
The problem is that the only way the Web Site project represents the project reference (to my knowledge) is through the presence 开发者_如何转开发of the compiled dll in the /bin directory. I don't want to include these generated files in version control (Subversion). Adding the files to the SVN ignore list -- as I usually do with /bin dlls -- is not an option because I lose the project reference.
So, the question: is there a way to maintain a project reference in a Web Site project other than putting the dll in the /bin directory?
If not, I plan to move the class library into its own solution and use a .refresh file. Since the projects will always go together, this is not my preference.
You could try creating an empty Visual Studio solution, then add the Website Project and also your new project for the class library you created. It's a bit of a half-way-house, you can have the solution compile to check everything is ok, but you don't actually need to. So you keep the relaxed style of a Web Site but have the ability to relate projects.
Then you can keep the class library project in the same repository and keep on excluding the compiled dll from the bin of the website. If you get your class library to put a copy of the dll in a 'libs' folder in the root of the repo then you can reference it from there into your website.
Your folder structure would then be something like - YourProject -- Website -- Your class library -- libs (3rd party libraries, including your class library) -- Tests -- Anything else
I believe the references are maintained in the solution file for you.
For websites there is a section in the Solution file as follows:
Project("{GUID}") = "WebsiteName", "WebsiteName", "GUID"
ProjectSection(WebsiteProperties) = preProject
.... removed for brevity ...
ProjectReferences = "{GUID OF REFERENCED PROJECTS}|ProjectName.dll"
.... removed for brevity ...
EndProjectSection
EndProject
Hope this helps
精彩评论