1

I've user controls project (UI) and am using AJAX Extension Toolkit with them. The dll of AJAX Extension Toolkit is referenced in the project. The project is successfully compiling.

Another project under same solution which is WSPBuilder project (Deploy). When you build UI project all the controls will be copy to Deploy project directory 12\TEMPLATE\CONTROLTEMPLATES and a dll of UI project also copied to GAC folder. (For copying, am using post-build events)

Then, build Deploy project using WSPBuilder Build and deploy. I'm getting error message:

An error occurred during the processing of . Unknown server tag 'asp:ScriptManager'.

Please, don't say that I've to manually modify the web.config to add and mark the ajax extension as a safe control. I'm not going to do that.

Any better solution?

P.S: I'm using WSPBuilder, STSDEV and VSeWSS.

EDIT

Thanks to Chris. The problem was:

In this case, I think it's other elements in web.config which you are missing - the AJAX declarations. Amongst other things, you need the following in your web.config so .Net knows how to find the ScriptManager class:

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

But this problem goes a little weird at my side. I had to set enableSessionState to true of pages tag under system.web and uncomment the following:

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

I thought putting AjaxExtension.dll in GAC can resolve this issue. I was avoiding to write a feature for modifying web.config. Can I do this too in manifest.xml?

Please, suggest!

1
  • No, to make the web.config changes you'll need to write a feature (or use someone else's, like the Codeplex project I linked to). ALSO, the assembly will need to go into the GAC (this will happen if it's in your WSP package and DeploymentType is set to 'GAC' in the manifest.xml), but both of these things need to be in place. Session state is not related - SharePoint only needs this if you are using InfoPath Forms Services AFAIK. Commented Feb 12, 2010 at 12:54

3 Answers 3

3

The error you're seeing doesn't appear to be related to the SafeControls entry. If that was the case, you'd see a message saying "Unable to add selected web part(s). A Web Part or Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe."

In this case, I think it's other elements in web.config which you are missing - the AJAX declarations. Amongst other things, you need the following in your web.config so .Net knows how to find the ScriptManager class:

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

You have a couple of options:

  • Use the feature in the popular SharePoint Features Codeplex project which will make the web.config changes
  • Write your own code to make the web.config changes using SPWebConfigModification.

The full details of the web.config changes required are detailed here in Mike Ammerlaan's blog.

Whichever route you take, check the version of AJAX you're using against the guidance/samples you use.

5
  • Thanks again Chris. I was looking into my last post where I had a great discussion with you and Wictor. I was wishing to have an option to invite you two. I'm blessed :) Thanks. You're absolutely right. Except there few more thing were missing which I mentioned in the question as EDIT. Guidance please!
    – Anonymous
    Commented Feb 12, 2010 at 11:29
  • No problem. So did you mean there was another question which you'd like more conversation/help on? I had a quick look but couldn't find it, but if you leave the link here I'll do my best to take a look! Commented Feb 12, 2010 at 11:36
  • Sorry. I was updating the question. Left you comment before updating the question. Please, check the question now. I mention the detail over there what was also missing. Thanks!
    – Anonymous
    Commented Feb 12, 2010 at 11:39
  • Can I do this in manifest.xml? I mean the 'add' tag and 'enablesessionstate' in manifest.xml and on deployment it update the web.config.
    – Anonymous
    Commented Feb 12, 2010 at 11:44
  • 1
    No - you need a feature which has some code which uses SPWebConfigModification to make such changes. Only some changes (e.g. SafeControls) can be made from whatever is in the manifest.xml file. Commented Feb 12, 2010 at 12:55
3

A comment from the WSPBuilder site.

Nice work! Adding third party DLLs worked great when I deployed AJAX and the AJAX Control Toolkit. I created a feature to do all the web.config changes and used the GAC\Reference folder to include the Control Toolkit DLL. Worked great even with multiple servers in the farm. That was a life saver!

So include the dll in your WSPBuilder project to get it included, then create a feature to modify web.config. See this post for information on modifying web.config with a feature.

2
1

First you have to add the assembly you want to deploy into the VS project. For example you can create a "libs" folder to store all external assemblies you'll need in your team site.

Then you have to edit the manifest.xml file of your Team Site Definition. You can find this file within the "pkg" folder within your project. Be aware that the pkg folder will only be available if you've at least deployed the solution one time.

OK, now you have to add a new <Assembly> child element to the <Assemblies> element within the manifest.xml file of your Team Definition solution. With the "DeploymentTarget" Attribute you can define whether the assembly should be deployed to the GAC or to the web application's bin folder.

The following example shows how the <Assemblies> element looks like if you want to add the "TeamSiteDefinition1.dll" to the GAC and to add the "TestSolution.dll" to the bin folder. If you need a safe control entry for your assembly you can add this one too.

<Assemblies>
    <Assembly Location="TeamSiteDefinition1.dll" DeploymentTarget="GlobalAssemblyCache" />
    <Assembly Location="TestSolution.dll" DeploymentTarget="WebApplication">
       <SafeControls>
          <SafeControl ..... />
       </SafeControls>
    </Assembly>
</Assemblies>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.