In the last post in xLim 2 series I’ve talked about the overall folder organization of the xLim solutions (including documentation, version control and integration). Let’s drill down to the scope of the atomic Visual Studio solution.

Caveat, Reader: although this solution structure is based on multiple articles, guidelines and delivered projects, it is tailored specifically for the xLim 2 or similar implementations (see the requirements page).

General guidelines for the xLim solutions

  • Every solution should be atomic. It should not contain any links or references to any projects, resources or libraries outside the trunk directory
  • If the solution has to reference code from the other solutions (like it is done by any extension project), then the referenced code should be in binary form and located in the trunk\Resource[ReferencedSolution]
  • All assets that are used in the process of integration, build and distribution (i.e.: build tools, templates for help generation, images, xsl transforms, code analysis tools etc) should be stored in the Resources where appropriate (versioning .NET 2.0 SDK redistributables is not a good idea).
  • All machine-specific config files (web.config, app.config) should be stored in SVN as *.config.template.
  • Visual studio solution file is named [Solution] and located in the trunk\ directory. Secondary solution files are allowed (i.e.: solution w/o Tests, solution with examples)
  • Primary build file should be located in the same directory with the .sln and be named [Solution].build
  • Every primary build file should contain following targets
  • clean – launches MSBuild  for the [Solution].sln, wipes trunk\Build and all temporary files and build artifacts
  • build – generates temporary “VersionAssemblyInfo.cs” (if version parameter is passed), then launches MSBuild for the [Solution].sln
  • copy – copies relevant build output files into the appropriate Build[Name] directory
  • distrib – produces redistributables from the Build[Name] files and places them in Build\Distrib (integration server can override this with parameter)
  • test – runs unit tests for the [Build]\Test
  • integrate – executes clean, build, copy, test
  • config – configures hosts in the Build[Name] using the passed parameter as a reference to the configuration folder
  • release – executes integrate, config, distrib
  • Every trunk\ directory should contain “go.cmd” file that has the code

    @echo off @Resource\NAnt\NAnt.exe -buildfile:[Solution].build %*

Guidelines for the source projects

  • Source projects should be located in the trunk\Source directory. They should be named in [Solution].[Section].[AssemblyType] format where
  • [Solution] bears the name of the implementation project (e.g. “xLim2”) or the name of the extension (e.g. “xLim2.Crm”)
  • [Section] logically groups project by the implementation specifics:
  • Shared – code that is common to all Sections areas
  • Server – xLim server code
  • Client – code for the desktop interface
  • Web – web interfaces
  • Engine – code for the automation “interface”
  • Tool – different utilities and command-line helpers normally get this namespace
  • [AssemblyType] specifies type of the code within the assembly:
  • Interface – interfaces and common types.
  • Core – actual implementations of the items declared in the interfaces.
  • Host – entry points for the
  • Web – web application)
  • Client – Win.Forms application)
  • Server – either embedded into web, windows service or separate IIS hosted web service
  • There could additional types of code libraries if needed (i.e.: Shared.Data, Client.DxCore, Web.DxCore)
  • There should be 2 files in the Source directory
  • VersionAssemblyInfo.cs

    using System.Reflection;

    [assembly : AssemblyVersion(“1.0.0.0”)] [assembly : AssemblyFileVersion(“1.0.0.0”)]

  • GlobalAssemblyInfo.cs. For example:

    using System.Reflection;

    [assembly : AssemblyCompany(“Landor Systems”)] [assembly : AssemblyProduct(“xLim 2 Framework”)] [assembly : AssemblyCopyright(“Copyright © Landor Systems 2008”)] [assembly : AssemblyTrademark(“”)]

  • All VS projects in the Source folder should reference these source files as links.
  • Source projects should follow these reference rules:
  • [Section].Interface can reference only Shared.Interface and framework assemblies (no 3rd party components)
  • Any [Section].* can reference Interface library from the same Section
  • Any [Section].* can reference Shared.Interface, any other references between the sections are prohibited.
  • Code for the [Solution].[Section].[Type] has default namespace of [Solution].[Section]

Guidelines for the test projects

  • Test projects are located in trunk\Test directory
  • Project that tests [Solution].[Section].[Type] should be named [Solution].[Section].[Type].Test
  • Test project can reference only [Solution].Test (common test helpers), assembly being tested or any of it’s references.

Note, that this article will be updated as xLim 2 requirements get settled down.