Importing Projects

This section provides procedures on importing a Visual Studio project using Generate Solution's POM Information... feature. This feature will generate pom.xml files from an existing Visual Studio solution file. The generated pom.xml file will contain the latest versions of the artifact dependencies used for the project.

Note: ASP.NET MVC should be installed to get the proper behavior when importing projects especially those projects with unsupported project types. (Refer to Pre-requisites section.)

  1. Right click on the project and select the Generate Solution's POM Information...
    .
  2. In the pop-up screen, Browse to the directory location of the parent solution file to use. Group Id is generated by default with the format of [company_id].[solution_name].
    .Importing parent solution file
  3. Click Generate POMs.

    Underscores and spaces in artifact's groupId are automatically deleted when added to the project's pom.xml. The table below shows the conversion of certain values of groupIds.

    Artifact Group Id Converted Group Id
    The.Project The.Project
    the.project the.project
    the project TheProject
    the_project TheProject
  4. From the Project Units Tests window, select the test modules to be used for the project and click OK.
    .Project unit tests list

    pom.xml files will be generated for all the projects that are included in the solution file: the parent project and its sub-projects, if there are any.

    Note: The Units Tests window is not displayed when importing unsupported project types. Hence, an unsupported project type warning is displayed. For multi-module projects with supported and/or unsupported project types, the supported projects are included in the parent pom while for the unsupported project types, these are not included in the parent pom, and a warning is displayed.

    For projects with web references, the pom.xml generated will contain maven-wsdl-plugin configuration similar to the following:

      <plugin>
        <groupId>npanday.plugin</groupId>
        <artifactId>maven-wsdl-plugin</artifactId>
        <extensions>true</extensions>
        <executions>
          <execution>
            <goals>
              <goal>wsdl</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <webreferences>
            <webreference>
              <namespace>AnotherWebService</namespace>
              <path>Web References/AnotherWebService/AnotherWS.wsdl</path>
              <output>Web References/AnotherWebService/</output>
            </webreference>
          </webreferences>
        </configuration>
      </plugin>
    

    The wsdl goal is the one responsible for building and creating webservice proxy classes. And, all the web references used in the project are listed inside the <webreferences> tag. For more instructions on adding, renaming, and deleting web references, refer to Web References section of this document.

Importing Projects with Resource File

If the project you are importing includes a resource file, the maven-resgen plugin is added to pom.xml during import.

In the plugin's configuration, you can find the list of resource (resx) files with corresponding names. By default, RootNamespace is the assembly name and RootNamespace.Filename is the filename of the resx files. To ensure that the plugin works, the following are required:

  • The classname and the filename of the item that contains the resx files must have the same name. Example:

    "public class frmMaestroName" = frmMaestroName.resx = frmMaestroName.cs

    Note: Changing the codefile(.cs/.vb) automatically updates the resource(resx) file. In some instances, however, this does not hold true.

  • The namespace of the project should be equal to the DefaultNamespace of the project assembly. To check the default name,
    • Right-click on the project and select Properties. This displays a project property window.
    • Select the Application tab.
    • In the DefaultNamespace field, you will find RootNamespace.

Once the above requirements are met, the importer automatically does the work and there is no need to edit pom.xml.

Removing the configuration part of the maven-resgen plugin allows the plugin to locate all the resx files and compile them as ArtifactId.Filename. If you set the namespace as the artifactId, you do not need to list all the resx files in the pom.xml.

Note: This feature does not support cultured esx files such as eu-US, it, jp, de, eu-UK, and even custom culture.

Importing WPF/WCF Projects with XAML files

If the project you are Importing is a WPF/WCF project and it contains a XAML file the MSBuildPlugin will be automatically added into that project's pom file.

  <plugin>
        <groupId>npanday.plugin</groupId>
        <artifactId>NPanday.Plugin.Msbuild.JavaBinding</artifactId>
        <extensions>true</extensions>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
  </plugin>

This will generate the needed *.g.cs/*.g.vb files that are needed for those XAML files.

Note: The user would encounter double dependency errors, if the project was created with 3.0 .net framework. We suggest that you change your framework to 3.5 and then delete the references that are already included as defaults in NPanday. This will then allow your project to run successfully.