views:

240

answers:

2

Good Day,

We're working on custom module (Information Management System) for SharePoint. The project file of this module is a Class Library which contains User Controls. The User Controls was based upon SmartPart and AJAX Extension Toolkit. The module has a separate database which has tables/views/stored procedure.

On development environment, we deploy the module in following steps:

  • Restore the backup copy of the module database on the pre-production or test environment
  • Install AJAX Extension Toolkit
  • Modify web.config of web application for connection string, safecontrol entry of AJAX Extension, enablesessionstate set to true of pages, add AJAX Extension tag entry, and uncomment the following line:

    <add name="Session" type="System.Web.SessionState.SessionStateModule"/>

  • Create a UserControls folder in web application root and copy all User Controls there. As SmartPart will (can only, I assume) locate User Controls

This is how we do. I sure this is not a good practice and there should be ways to do this in much better way.

One of my question is can we create a separate web.config file which will have all required tags and settings there so we won't need to change web application web.config? Just guessing!

As all WSPBuilder users are aware of this, that you cannot modify the manifest.xml file and no good integration with web application folder. I don't why SmartPart pick the web application root folder to locate User Controls. Is it possible that SmartPart can start picking User Controls from 12-Hive's TEMPLATE\CONTROLTEMPLATES folder?

We are looking for a more appropriate way of doing this. And for me, specific to this case, a good practice would be eliminate all the manual configuration/setup steps. The module user doesn't even need to do a single manual setup to make this thing up and running. I am sure there are many ways of doing this much better than this but what would be the best way to handle it.

Also, I would like to have suggestions on Custom Module development on SharePoint good (or best) practices.

We are using a set of tools like WSPBuilder, Visual Studio Extension for WSS, STSDEV, SPVisualDev, SharePoint Content Deployment Wizard, SharePoint Administration Tools, SharePoint Installer.

Thanks.

Have a Good Day!

A: 
Janis Veinbergs
Janis, It doesn't work with 80 folder.
Ramiz Uddin
Sorry. I looked up into doc's, and predefined folders only works. See edited answer.
Janis Veinbergs
try to create a folder of UserControls under 80 but it didn't create it there in the web application root when I deployed using WSPBuilder Deploy option.
Ramiz Uddin
more precisely it doesn't support user defined folders.
Ramiz Uddin
It should work (according to doc) if you create 80/resources/UserControls and if it works for you.
Janis Veinbergs
You're right, Janis. But, another problem came with it. UserControls folder has *.ascx files and on deploy command it should create and copy all the files, along. But the UserControls folder is empty. Then, I checked the wsp file, rename it with wsp.cab. It only contains dll not ascx files. Why?
Ramiz Uddin
Hmm, what if you try naming Folder same name as your DLL is? Do not know if it matters, but see http://wspbuilder.codeplex.com/Thread/View.aspx?ThreadId=15957
Janis Veinbergs
this should be as it is mentioned. let me check.
Ramiz Uddin
i've two folders 80\bin and 80\usercontrols but on deployment both are not created in the web application directory. ahhhh!
Ramiz Uddin
The WSP Schema do not support any form of custom folder creation in the 80 directory (*). by keutmann the creator of wspbuilder. check this link and his comments http://wspbuilder.codeplex.com/Thread/View.aspx?ThreadId=13906
Ramiz Uddin
i moved usercontrols folder to 80\resources\usercontrols. i thought this could solve the problem but whatever in the resources folder is not copying on the web application directory. nothing helpful.
Ramiz Uddin
+1  A: 

There is a way to point SmartPart to point to the ControlTempltes folder but it requires recompilation of the SmartPart solution. To get SmartPart to look inside the 12\CustomTemplates\YourFolder\ you'll need to get the code for SmartPart from codeplex, alter the code inside the point to where you need and recompile it and repackage as a WSP. This is how I got around the issue. If you do that and maintain your own version of it, you'll save development time in the future. We've done this and will reuse our own version with other clients in the future. Hopefully the SmartPart's original code will get updated to accommodate this.

Tip for SmartPart controls: Make sure you turn of any validators in he your controls when you're in edit mode else you'll end up filling out the all the fields in order to publish the page. SharePoint does funny things in edit mode so make sure you test all your usercontrols with the SmartPart in edit mode.

Deploying to resources I think this may be a permissions issues, usually people deploy assemblies to 80\bin and I don't remember doing anything special to make that work. Since wsp's are deployed via SharePoint, if SharePoint doesn't have permissions to the 'resources' folder, then that might fail. Possible issues: a) Resource folder doesn't exist in inetpub or wherever you're root folder is. (Try creating the structure) b) Resource folder doesn't have the same permissions set as the bin folder. (Test to see if you can deploy an assembly to the bin) c) Resource folder is readonly and thats causing the problem. (Take off read only) d) SharePoint never allows for files other than assemblies to be displayed to the root folder via WSP (Unlikely and not sure about this)

My recommendation for troubleshooting such an issue would be to extract the contents of the wsp into a folder (Rename the .wsp extention to .cab and extract the .cab) . Fiddle with the files and structure > create a cab file from it (google this) > Rename extention back to .wsp > Deploy > Test > If it doesn't work, fiddle with the structure again and try again.

Zeb
any idea why 80\resources folder not copying files to web application root?
Ramiz Uddin
updated the answer.. hope it helps
Zeb