Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!

share|improve this question
    
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. –  Chris O'Brien - MVP Feb 12 '10 at 12:54
add comment

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
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 Feb 12 '10 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! –  Chris O'Brien - MVP Feb 12 '10 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 Feb 12 '10 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 Feb 12 '10 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. –  Chris O'Brien - MVP Feb 12 '10 at 12:55
show 1 more comment

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.

share|improve this answer
    
But I think this could be done through manifest.xml. grounding.co.za/blogs/brett/archive/2008/05/23/…. What would you say? –  Anonymous Feb 12 '10 at 9:54
    
Yes, but with WSPBuilder the manifest is created for you. You're not manipulating it yourself. –  Mikael Svenson Feb 12 '10 at 13:31
add comment

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>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.