3

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.

Jerph
  • 4,572
  • 3
  • 42
  • 41
  • 3
    You've found more reasons to not use web site projects. Web Application Projects don't have these problems. – John Saunders May 11 '10 at 16:48
  • Yes, the reasons are piling up. Unfortunately the project's a bit of a mess. I've tried to convert a few times and given up on getting it to build. Pulling code into class libraries was a first step to making conversion possible. – Jerph May 11 '10 at 16:53
  • Did you find a solution to this issue? Could you add it as an answer? I have a similar problem. App where I don't have control over converting from website to web application. Would like to exclude bin from subversion. – Becky Jun 17 '11 at 22:55
  • I think .refresh file is the way you need to go. Here is similar thread been answered http://stackoverflow.com/questions/279451/visual-studio-website-reference-paths – Subhash Dike Jan 04 '12 at 11:38
  • @Becky - I use SVN (with the Tortoise add-on for Windows Explorer). To exclude the `bin` folder I right-click it and delete/ignore from the Tortoise context menu. – immutabl Jan 24 '12 at 14:13

2 Answers2

0

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

Simon Martin
  • 4,203
  • 7
  • 56
  • 93
0

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

gregpakes
  • 4,465
  • 29
  • 43