views:

100

answers:

3

I have asp.net mvc 2 application.

Now I'm reimplementing it for working with Ninject. All is fine except one thing: where should I store Ninject.dll??

I've created lib directory inside my appdir and made reference to lib/Ninject.dll.

But may be there are some general conventions on how to act in such cases?

+2  A: 

The convention is using this folder structure:

  • Project trunk.
    • build
      • Build scripts.
    • db
      • Database staff. (you should version control the db with the all code).
    • docs
      • Documentation, specification and all what that related.
    • lib
      • Ninject
    • src
      • ProjectName.Core
      • ProjectName.UI
      • ProjectName.sln
Mendy
what is "src" according to asp.net mvc application?
zerkms
In src you're putting the project itself.
Mendy
and how now mvc application now will get that i've moved the approot?
zerkms
isn't it weird to move all pre-generated things into `src` (which is not-common in mvc2 practice)?
zerkms
It's not wired. you don't want the lib folder to be along your projects. It's need to be in a higher level.
Mendy
Ralph Willgoss
@Ralph: hmmm.... but MVC is a framework. How can we compare framework practices with specific applications practices?
zerkms
@Mendy: currently i have only one library. when i will have a lot of them - i probably will place .dlls into a GAC.
zerkms
@zerkms you don't want to do that. GAC it's not the place for that, because, 1. libraries versions change a lot, and every application depends on a specific one. 2. you will need to put it in the GAC of every deployment machine.
Mendy
oops, i wasn't looking at the updated scheme when i was writing my last comment. yep, if src is a directory contains complete solution - then yep, this scheme is a good too. but how then to distribute application if 3rd party libraries are outside the projectdir?
zerkms
If they are referenced by the project, so the need to be on the bin folder on the default project.
Mendy
@Mendy - I was just giving you an example. The structure that myself and @37stars have shown, works for pretty much any project of any type. People modify slightly to suit their own build processes and conventions used on the platform they are developing on.Check out some projects on the net (github and codeplex) and you'll get an idea of how say Ruby, .Net and Python all organize their projects and see the commonalities but also the slight deviations.
Ralph Willgoss
@Ralph I saw this schema on a lot of projects, take CodeCampServer as an example.
Mendy
sorry @Mendy, I meant to answer @zerkms question
Ralph Willgoss
+2  A: 

UPDATE: FYI - Here's a link to how the MVC team structure their own repository.

As part of my MVC directory setup, I place libraries outside the project in their own folder structure and add references to those libraries.

So my checked out directory structure would look something like:

Apps
   Project 1
    - Project files 

   Project 2
   - Project files 

Libraries
- LibraryName
-- LibraryVersion

This provides a standard place for all libraries to be placed, particular useful when multiple projects are using the same libraries and having one south of truth.

Makes trouble shooting build server reference issues much easier too.

HTH

Ralph Willgoss
Yep, I thought in the same manner.
zerkms
+2  A: 

I think it depends on what you're going to do with the application. If the project will be shared with other developers I would use one of the structures outlined in the other answers. However if this is a project internal to your organization where you'll have multiple projects and developers, hopefully all sharing the libraries. I would use something like this, where the library contains only DLLs:

  • Library
    • Ninject
      • 1.0
      • 1.5
      • 2.0
    • NHibernate
      • 2.1.0
      • 2.1.2
  • Project 1
  • Project 2

This is a structure we have implemented in our development process. We have multiple projects using different versions of the same library. We can migrate applications to newer versions of the library very easily. This also prevents having seven copies of a DLL in seven different projects.

For our own internally developed libraries the code is stored in the tree under a project with the DLLs being copied to the Library branch. Our projects then reference the release versions.

This structure makes it easy to keep versions of open source libraries in sync (e.g. Hibernate, Fluent NHibernate, and NHibernate Linq).

37Stars
how then application deploy? i mean - how do you compose complete set of what is necessary for application? after building .exe it points to ../../..../Library/Ninject/2.0/Ninject.dll. Or I have missed something?
zerkms
When you add references, in Visual Studio select the 'Properties' for the reference and check that 'copy local' is True. When the project is built the dlls will be placed in the correct output folder. The project file will always keep the original source path.
Ralph Willgoss
It's just as Ralph states.
37Stars