Skip to end of metadata
Go to start of metadata

The following directory structures should be supported by NMaven

1. Multi-module Projects

Multi-module project with a parent pom containing one or more modules, then a subdirectory for each module, which equates to a VS "project". The .sln file sits beside the parent pom, and each subdirectory contains a .csproj, pom.xml and source code. Source code is not typically put in a subdirectory under the module, but it might be. NUnit test code may be within each module in a directory named "Tests", or it may be in a separate module.

C:\PROJECTS\MYSOLUTION
│   MySolution.sln
│   pom.xml
│
├───MyClassLibrary
│   │   Class1.cs
│   │   Class2.cs
│   │   Class3.cs
│   │   Class4.cs
│   │   MyClassLibrary.csproj
│   │   pom.xml
│   │
│   └───Properties
│           AssemblyInfo.cs
│
├───MyClassLibraryTest
│   │   MyAppTest.cs
│   │   MyClassLibraryTest.csproj
│   │   pom.xml
│   │
│   └───Properties
│           AssemblyInfo.cs
│
└───MyConsoleApplication
    │   MyConsoleApplication.csproj
    │   pom.xml
    │   Program.cs
    │
    └───Properties
            AssemblyInfo.cs

2. Flat Single Module Project

Flat structure with pom.xml, .sln, .csproj and source code all in the same directory. Source code is not typically put in a subdirectory under the module, but it might be. If present, NUnit test code should be in a directory named "Tests", which is not packaged in the main artifact. See note below about "nested" projects. The "flat" structure is only supported as a single project with no sub-modules, for projects of type 'library' (dll) and 'exe'.

C:\PROJECTS\FLATSINGLEMODULE
│   Class1.cs
│   FlatSingleModule.csproj
│   FlatSingleModule.sln
│   pom.xml
│
└───Properties
        AssemblyInfo.cs

3. Visual Studio Web Site Project

Visual Studio "Web Site" (File -> New -> Web Site) project with .sln file copied into the project directory and modified to normalize paths. NMaven will build a zip file containing the aspx files and compiled dlls (in a bin/ directory). Note: There is an issue with building this type of project twice in a row: you must 'clean' before building again.

C:\PROJECTS\WEBSITE2
│   Default.aspx
│   Default.aspx.cs
│   WebSite2.sln
│   pom.xml
│
└───App_Data

4. Visual Studio ASP.NET Web Application

Visual Studio "ASP.NET Web Application" (File -> New -> Project, "ASP.NET Web Application"). Structure is similar to (1) with a parent pom and .sln file at the top, plus a subdirectory for each project/module. NMaven should build a .zip file as in (3) containing pages and dlls.

C:\PROJECTS\MYPROJECT
│   MyProject.sln
│   pom.xml
│
└───MyWebApplication
    │   Default.aspx
    │   Default.aspx.cs
    │   Default.aspx.designer.cs
    │   pom.xml
    │   MyWebApplication.csproj
    │   Web.config
    │
    ├───bin
    ├───obj
    │   └───Debug
    │       └───TempPE
    └───Properties
            AssemblyInfo.cs

Note: Some versions of NMaven have limited support for a "nested" project-within-project structure with source code in the parent directory. This structure will have a .sln and .vbproj file at the top, then directories for additional modules beneath, each containing a .vbproj file. This structure is NOT RECOMMENDED and not likely to be fully supported by Maven tools such as the Release plugin.

TODO: ASP.NET Web Service Application

TODO: ADO.NET project structure

NOTE: In the examples, .vbproj and .csproj are interchangeable, each structure should work for any language, and a solution may be composed of different modules using different languages. In addition, tests within a module may be written in a different language than the main artifact.

  • No labels

5 Comments

  1. For Visual Studio we should put a 'Test' directory in the main module, thus allowing main and tests classes to be in single project. When NMaven compiles the main artifact, it will leave out the test classes.

  2. Visual Studio seems to use plurals (Properties, References). Can we use "Tests" instead? (Is this hard-coded in NMaven, or does it look at the value of <testSourceDirectory> ?)

  3. Sure 'Tests' would be fine. As I recall, it's configurable through the pom, but hard-coded in the VS Addin.

  4. Thanks, I'll open an issue to see if we can align the two and make them both use the same configuration.

    What will happen when building in Visual Studio, then? How will it know not to include the Test source code when packaging the library?

    The solutions I'm looking at are using a separate project for the tests. (Separate directory with .csproj file.)

  5. I put the layouts that the VS Addin is expected to support into a separate section.

    Currently for (1) it is generating two .csproj files, one for the code and one for the tests. But Maybe that is incorrect, and (1) and (3) are actually the same thing.