Register / Login
Administración :|: Apariencia :|: Desarrollo :|: Servicios :|: DNN Library
  ..:: Dotnetnuke » DNN Library ::..
DNN Library Index    

Preguntas / Questions    

Usa los Foros de DNNLA para realizar tus preguntas. Solo necesitas estar registrado.

Please use the DNNLA forum to ask questions. All you need to do is register as a user.


DNN Library  Print    Minimize
Moving DNN 3 modules to work as DNN 4 WAP modules

You will only need to get the Required Files and Modify the template once. Then you can use the template again and again to move your DNN 3 module source code to DNN 4.

REQUIRED FILES
Dotnetnuke versions
As a first step, download the Install or Source version and the Starter Kit, we won't detail the installation process of Dotnetnuke, instead we'll just make a point. We've found that most of the time we don't use Dotnetnuke's source, since we prefer to use the class browser. Therefore, we recommend that you use the Install version. On the other hand, install and run the Source version if you check Dotnetnuke's source code very often.

Visual Studio WAP Extension
Download and install the WAP extension for Visual Studio 2005. Note that you need to uninstall the WAP extension before upgrading to VS 2005 SP1.

THE VISUAL STUDIO TEMPLATE
Visual Studio automates the creation of projects using templates, which are zip files with the extension changed to .vsi. and an XML manifest file with the .vscontent extension. The templates contains other zip files which will be placed in the Visual Studio Template Directory after being installed. The Dotnetnuke 4.4.1 StarterKit version comes with five templates, we will modify the Module_Compiled_VB.zip which is the template for creating WAP Module projects.

Modify the Visual Studio Template
Change the Dotnetnuke_4.4.1_StarterKit.vsi file extension to .zip and then extract the Module_Compiled_VB.zip to your file system. Open the zip file and remove the unnecessary content first:

1. Delete the following files:

  • *.SqlDataProvider
  • *.ascx
  • *.vb including *.ascx.designer.vb
  • *.dnn

2. Delete the following folders:

  • App_LocalResources
  • Components
  • Documentation

3.  The DotNetNuke Module.vstemplate file contains the template settings that will control the creation of the templated project, including parameter replacement. Since we removed file and folder items from the template we need to make sure no reference to them exists. This file is marked Read Only, unmark it so we can modify its contents. After doing so, open it using Notepad and replace the entire content with this:

<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
  <TemplateData>
    <DefaultName>ModuleName</DefaultName>
    <Name>DNN 3 WAP Upgrade Holder</Name>
    <Description>Creates a DotNetNuke placeholder project to move your DNN 3 Modules</Description>
    <ProjectType>VisualBasic</ProjectType>
    <ProjectSubType></ProjectSubType>
    <SortOrder>10</SortOrder>
    <CreateNewFolder>true</CreateNewFolder>
    <ProvideDefaultName>true</ProvideDefaultName>
    <LocationField>Enabled</LocationField>
    <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
    <Icon>DotNetNuke.ico</Icon>
  </TemplateData>
  <TemplateContent>
    <CustomParameters>
        <CustomParameter Name="$YourCompany$" Value="YourCompany"/>
    </CustomParameters>
    <Project TargetFileName="$safeprojectname$.vbproj" File="ModuleName.vbproj" ReplaceParameters="true">
    </Project>
  </TemplateContent>
</VSTemplate>

4. Save and replace the file inside Module_Compiled_VB.zip again.

Modify the Project Template
Now we will modify the project template to work as the container for our old DNN3 module. Extract the ModuleName.vbproj from Module_Compiled_VB.zip. This file is marked Read Only, unmark it so we can modify its contents. After doing so, open it using Notepad and follow this steps:

1. If you are using the Source version, skip this step. Look for the section below and remove it completely. This will remove the reference to the Dotnetnuke.Library.

  <ItemGroup>
    <ProjectReference Include="..\..\DotNetNuke.Library.vbproj">
      <Project>{D391550C-7107-49B2-A6AC-8627C8B06ADC}</Project>
   <Name>DotNetNuke.Library</Name>
    </ProjectReference>
  </ItemGroup>

2. If you are using the Source version, also skip this step. Insert the following line:

    <Reference Include="DotNetNuke, Version=4.4.1.26939, Culture=neutral, processorArchitecture=MSIL" />

after <ItemGroup> and before     <Import Include="DotNetNuke" />

3. Remove the creation of template files, by deleting this section:

  <ItemGroup>
    <Compile Include="Components\DataProvider.vb" />
    <Compile Include="Components\$safeprojectname$Controller.vb" />
    <Compile Include="Components\$safeprojectname$Info.vb" />
    <Compile Include="Components\SqlDataProvider.vb" />
 <Compile Include="Edit$safeprojectname$.ascx.designer.vb">
   <DependentUpon>Edit$safeprojectname$.ascx</DependentUpon>
 </Compile>
 <Compile Include="Edit$safeprojectname$.ascx.vb">
   <DependentUpon>Edit$safeprojectname$.ascx</DependentUpon>
   <SubType>ASPXCodeBehind</SubType>
 </Compile>
 <Compile Include="Settings.ascx.designer.vb">
      <DependentUpon>Settings.ascx</DependentUpon>
    </Compile>
    <Compile Include="Settings.ascx.vb">
      <DependentUpon>Settings.ascx</DependentUpon>
      <SubType>ASPXCodeBehind</SubType>
    </Compile>
    <Compile Include="View$safeprojectname$.ascx.designer.vb">
      <DependentUpon>View$safeprojectname$.ascx</DependentUpon>
    </Compile>
    <Compile Include="View$safeprojectname$.ascx.vb">
      <DependentUpon>View$safeprojectname$.ascx</DependentUpon>
      <SubType>ASPXCodeBehind</SubType>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <None Include="App_LocalResources\Edit$safeprojectname$.ascx.resx" />
    <None Include="App_LocalResources\Settings.ascx.resx" />
    <None Include="App_LocalResources\View$safeprojectname$.ascx.resx" />
 <None Include="01.00.00.SqlDataProvider" />
    <None Include="$safeprojectname$.dnn" />
    <None Include="$safeprojectname$.SqlDataProvider" />
    <None Include="Uninstall.SqlDataProvider" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="Documentation\Documentation.css" />
    <Content Include="Documentation\Documentation.html" />
    <Content Include="Documentation\logo.gif" />
    <Content Include="Edit$safeprojectname$.ascx" />
    <Content Include="Settings.ascx" />
    <Content Include="View$safeprojectname$.ascx" />
  </ItemGroup>

4. The Dotnetnuke original template uses <IISUrl>http://localhost/DotNetNuke_2</IISUrl>, so
make sure it matches your Dotnetnuke installation URL.

5. We are done with the modifications. Save and replace the file inside Module_Compiled_VB.zip again.

Install the template
Before we can use the template, it is necessary to install it. Rename the Module_Compiled_VB.zip as DNN3WAPupgrade.zip and place it inside the Visual Studio 2005\Templates\ProjectTemplates\Visual Basic directory in your Visual Studio installation. If you are unsure where this folder is, you can simply add the DNN3WAPupgrade.zip to the StarterKit.zip, change the file extension to .vsi and reinstall it.

USING THE TEMPLATE
Now that you are ready to use the template, it's time to move your project from DNN 3. Follow these steps:

1. Create the holder project. In Visual Studio select New /Project. You will see a template called DNN 3 WAP Upgrade Holder, select it.

2. In the Name box type the exact name of the original directory of your DNN 3 Module, the one that goes inside the Desktop Modules directory.

3. In the Location box browse to your Dotnetnuke\DesktopModules directory. Click OK. the destination folder has been created.

4. We need to create a clean copy of the original DNN 3 module so using the windows browser find the original DNN 3 module source folder, and make a copy of it. This will be the Clean DNN 3 Source folder.

5. Delete the following from the Clean DNN3 Source folder:

  • all *.sln files
  • all *.suo files
  • all *.vbproj files
  • any *.ascx.resx file EXCEPT FOR THE LOCALIZATION FILES. Localization files are usually inside an App_LocalResources or App_GlobalResources directory.
  • all *.dll files
  • any *.xml files generated by vbcommenter if you used it in VS 2003
  • any *.pdb files
  • /obj and /bin directories

6. Copy the Clean DNN 3 Source folder contents to the folder created by the template. Remember that the destination folder is the one with the same name as the Original DNN 3 module source folder. Make sure you copy the contents and not the folder itself.

7. Go back to Visual Studio. In the solution explorer select the module project. Click on the Show All Files button and then the Refresh Button. Select all the dimmed files and folders include them in the solution. Change the RootNamespace by double clicking on the My Project item and selecting the Application tab. The template fills the value with the same name as the project, remove it. Verify the Assembly name value matches the one you had been using.

8. Right click the project and select Convert to Web Application.

9. Review the errors from the task list and correct them. Most of the time you might be missing references, just add them to the project and you should be good to go. The Project should compile without any changes to the code.

10. Install your module using the Create New Module feature and selecting your .dnn file. Then run your Sqldataprovider scripts.

At this point you are ready to continue development in .net 2.0, replacing obsolete code and leveraging the new classes available. Just like in DNN 3 you will be able to use PA zips to distribute your module without source.

Finally, one observation: The SqlDataProvider now is not deployed as a separate dll. If your module needs to provide compatibility with several databases, you can move it into a separate project, just like in VS 2003 and create different data providers.

Note: Many thanks to Christopher Paterra for his guidance.



   BackToCategory    1 of 1

Copyright 2002-2005 DotNetNuke   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2009 by DotNetNuke Corporation