Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0creating private assembly for dnn 4.9creating private assembly for dnn 4.9
Previous
 
Next
New Post
10/22/2008 11:47 AM
 
I am trying to find a way to create a private asembly out of the dnn 4.9 custom module that I have programmed in order to redistribute it without the source code. I used the 4.9 starter kit to create a local dnn portal and developed my custom module in my local portal using vs 2005 pro. I've read Michael Washington's article here:

http://www.adefwebserver.com/DotNetNukeHELP/DNN_PackageModule/Default.htm

I install my StudentInformation module with no errors but when I add it to a page I get the following error:

Error: Student Information is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Could not load type 'CBOSSInc.Modules.AIAStudentInformation.IStudentInformationView' from assembly 'App_Code.0tiziml4, Version=4.9.0.85, Culture=neutral, PublicKeyToken=null'. ---> System.Web.HttpParseException: Could not load type 'CBOSSInc.Modules.AIAStudentInformation.IStudentInformationView' from assembly 'App_Code.0tiziml4, Version=4.9.0.85, Culture=neutral, PublicKeyToken=null'. ---> System.Web.HttpParseException: Could not load type 'CBOSSInc.Modules.AIAStudentInformation.IStudentInformationView' from assembly 'App_Code.0tiziml4, Version=4.9.0.85, ...
...

This makes sense because the interface named IStudentInformationView was in the app_code\StudentInformation\Interfaces folder but was not compiled into the page dll files which I installed. According to Michael's article, you look for anything with *student* in it and deploy those dll files. In my case, there were only two dll files each mapping to StudentView.ascx and StudentSettings.ascx. So, as a way to try to trouble shoot this problem of the interfaces not being seen by my page dll files, I then took the compiled app_code.dll and put it in the bin folder to since it contains my IStudentInformationView interface that the page dll files need and then I get this error:

Parser Error Message: The type 'DotNetNuke.Common.Global' is ambiguous: it could come from assembly 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dnn\e85cab58\e0fdb716\App_Code.z9mbpogv.DLL' or from assembly 'c:\inetpub\wwwroot\dnn\bin\App_Code.DLL'. Please specify the assembly explicitly

Ok, so that won't work. I removed the app_code.dll and now am stuck. I don't know how to get this to work since my interfaces are in the app_code\StudentInformation\Interfaces folder. The article here: http://www.adefwebserver.com/DotNetNukeHELP/DNN_PackageModule/Default.htm
doesn't mention anything other than copying page dll files. My app_code folder has app_code\StudentInformation\Interfaces folder with all my interfaces in it and again, the page compiled dll files cannot get to them since they were not compiled into the page dll files.

Ok, so what do I do next? Simple, I do what any desperate programmer would do... toss the easy way of doing this and bite off a larger piece of pizza! I try something more difficult and still fail! I read this article from Michael:


http://www.dmbcllc.com/Articles/WebDevelopment/DotNetNukePAwASPNET20/tabid/260/Default.aspx

I follow every instruction exactly on the site and the damn web project xml file will not compile... keeps giving warnings and errors:

Warning 1 The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'SourceWebPhysicalPath' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. C:\Documents and Settings\User\Local Settings\Temp\Dir1\dnn_deploy.wdproj 12 6 Miscellaneous Files
...

so I ignore the warnings, which I understand can be common, but then when I compile the web project the website validation passes, it compiles around 50 directories skipping what I have stated to exclude in the ItemGroup section in the project xml file, but then I get the following errors:

Error 6 Could not load type 'CBOSSInc.Modules.AIAStudentInformation.IStudentInformationSettings' from assembly 'App_Code.o5luwgpe, Version=4.9.0.85, Culture=neutral, PublicKeyToken=null'. c:\inetpub\wwwroot\dnn\DesktopModules\AIAStudentInformation\StudentInformationSettings.ascx 1

Error 7 Could not load type 'CBOSSInc.Modules.AIAStudentInformation.IStudentInformationView' from assembly 'App_Code.o5luwgpe, Version=4.9.0.85, Culture=neutral, PublicKeyToken=null'. c:\inetpub\wwwroot\dnn\DesktopModules\AIAStudentInformation\StudentInformationView.ascx 1

So it cannot access my interfaces that I setup in the app_code folder. The path is app_code\StudentInformation\Interfaces and that folder contains the two interfaces that my .ascx pages use in their code behind files.

What can I do to get this to work? Can anyone help me out here? Who would have ever thought that deploying a dnn private assembly would make me go bald! Thanks for anyone who can help me keep the remainder of my hair!
 
New Post
10/22/2008 3:13 PM
Accepted Answer 

You should be able to include the app_code files in your module package, and DNN will install them in the site's App_Code folder for you, rather than distributing a .dll.

However, we suggest using the Web Application Project model, rather than the Web Site module that the starter kit template gave you.  If you create a new web application project and move your code into that, it will compile into one .dll that will be much easier to manage and deploy.  For more information on using the web application project, look at Ian's recent blog on the subject.


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
10/22/2008 6:32 PM
 
Thanks Brian for the post! I think I may be able to save some of my hair! I followed the blog you mentioned and the project compiles with no errors into a dll. This is exactly what I have been after! I created a .dnn install and it installed fine into my local dnn portal. However, when I try to add the custom dnn module to a panel such as the content pane, I get this error: DotNetNuke.Services.Exceptions.ModuleLoadException: The file '/dnn/DesktopModules/AIAStudentInformationVB/StudentInformationView.ascx.vb' does not exist. ---> System.Web.HttpParseException: The file '/dnn/DesktopModules/AIAStudentInformationVB/StudentInformationView.ascx.vb' does not exist. ---> System.Web.HttpParseException: The file '/dnn/DesktopModules/AIAStudentInformationVB/StudentInformationView.ascx.vb' does not exist. ---> System.Web.HttpException: The file '/dnn/DesktopModules/AIAStudentInformationVB/StudentInformationView.ascx.vb' does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath) at System.Web.UI.TemplateParser.ProcessCodeFile(VirtualPath codeFileVirtualPath) I am not sure why I am getting that error because in my asp.net project, that .vb file is actually in a WebUser folder in the project so the path to that file in the error is not even correct. Also, I only have the .ascx files and the .dll file in the .dnn setup file - so why is it looking for the .vb file since that is in the dll? something is going on here with pathing of files or there is just one more thing that I am missing. Do I need to adjust the inherits statement or any syntax in the .ascx controls to point to the dll file? I did not adjust those and they read... <%@ Control Language="VB" AutoEventWireup="false" CodeFile="StudentInformationSettings.ascx.vb" Inherits="Modules.AIAStudentInformation.StudentInformationSettings" %> Maybe this is why it is erroring? The .vb file does not exist in the folder so I must need to adjust something in this syntax to reference the compiled dll? Thanks if you can help!
 
New Post
10/22/2008 8:46 PM
 

If you wish to run your module as a PA (and I suggest that you do, for ease of development, packaging and upgrading) then you will not be running 'code behind' in your ascx files.  Building as a PA means you can just have the single module loaded into yoru developement envirnoment : a simple .bat file to copy the compiled dlls and .ascx into the /bin directory and desktopmodules/project directory (respectively) of your target test environment will then do the job of applying the changes.  THis is much faster than keeping the entire DNN Codebase loaded into your code editor and having to recompile the whole thing each time.  You can also put in a command line parameter and send the files to different test installs, for quick testing of different configurations and DNN versions (if necessary)

For my custom modules, I always build a DLL as a PA.   You would normally structure the project like this (I know you're developing in .vb, but the principles are the same):

project name

.. DataProvider.cs

..ProjectController.cs

..Entities

.....Entity1Info.cs

..UI

.....UserControl1.ascx

....UserControl1.ascx.cs

....App_LocalResources

......UserControl1.ascx.resx

....Project.dnn

....module.css

That's the basic structure of the DLL.  Note that because it is a class library, you can't 'add' a .ascx file using the menu - either copy one in from somewhere else or add a text file and rename it.

The top of your user control should have this declaration (again, in C#, but you can change to VB easily)

<%

@ Control language="C#" AutoEventWireup="false" Inherits="Project.UI.UserControl1" %>

Notice there is no mention of codebehind, codefiles or anything else.  Just the type (class) that the .ascx file 'belongs' to.    Of course, this is the type of the .ascx.cs file that is 'built' into your DLL.  

This means you can't use the double-click functionality of visual studio to create your events, and you'll have to manuallly code in the declarations for the controls on the user control file.  But as a talented ASP.NET programmer, that's not a problem for you, is it? :-)

When you package, don't distribute any code files (.vb/.cs) in your package.  There should be none in the .zip file, none mentioned in the .dnn file.   Just package the .ascx, .resx and .dll file and it will all work out the way you want.

Incidentally, this was the advice in early 4.0 days for building all modules.  It's only later on in the DNN life cycle that the app_Code folders started to get used.  It's still OK to use them for quick'n'dirty apps, but if you want to build a lot of modules, you'll soon tire of having to recompile the entire DNN website in order to make changes and test them.   The app_code style to me is for people who are just getting started with DNN and want to do lightweight, quick modules.  If you're building serious code then go for a PA approach.

Hope this helps

-Bruce

 
New Post
10/22/2008 9:52 PM
 
Thanks Bruce for the post! I've removed the code file directives from my .ascx files but the type cannot be found. I am missing something extremely simple here.

I have a namespace of Company.Modules.StudentInformation and it has a class called StudentInformationView. In the .ascx file, in the inherits statement, I have inherits="Company.Module.StudentInformation.StudentInformationView" but I am getting the error that the type cannot be found. Somehow, this is still unable to see my compiled dll file in the dnn\bin folder to map the type. The name of the dll is called StudentInformation.dll - could that be the problem? Does the dll need to be the same name as the inherit statement type? The StudentInformation.dll has the type in it, the studentInformationView class, but it cannot see it.

Any advice on how to get the .ascx file to see the StudentInformation.dll file in the dnn\bin folder?

I am missing something extremely simple here *sigh*.

Maybe something is not mapped correctly in the project properties related to assembly name and default namespace?

Using your example you just posted, what would you set your assembly name to be and also your default namespace in the project properties?

btw why do you prefer to build your dnn custom module as a class library project rather than a wap? Brian mentioned wap earlier in this thread in the blog link that he posted explaining how to use wap for custom dnn development.

Thanks again for the help!
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0creating private assembly for dnn 4.9creating private assembly for dnn 4.9


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out