Dealing with “Assembly x contains a Web resource with name x, but does not contain an embedded resource with name x. “
February 22nd, 2007
I got the go-ahead to move the ListSearchExtender from the prototype branch of the AJAX Control Toolkit to the development branch, and everything was going swimmingly until I got this error when running:
Assembly 'AjaxControlToolkit, Version=1.0.10201.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' contains a Web resource with name 'AjaxControlToolkit.ListSearchBehavior.js', but does not contain an embedded resource with name 'AjaxControlToolkit.ListSearchBehavior.js'.
I checked, and yes my ListSearchBehavior.js file did have its Build Action property set to Embedded Resource so the solution wasn’t that easy.
Next I fired up the ildasm tool that comes with the .NET SDK and double-clicked on the manifest. Here I got a clue as to what was happening. It showed that the embedded resource was called AjaxControlToolkit.ListSearchBehavior.ListSearchBehavior.js whereas all the others were called things like AjaxControlToolkit.DropShadow.DropShadowBehavior.js
I went digging in my code and sure enough, I’d screwed up my assembly and ClientScriptResource attributes. This is the corrected version (the bold bits used to say ListSearchBehavior):
[assembly: WebResource("AjaxControlToolkit.ListSearch.ListSearchBehavior.js", "text/javascript")]
namespace AjaxControlToolkit
{
…
[ClientScriptResource("AjaxControlToolkit.ListSearchBehavior", "AjaxControlToolkit.ListSearch.ListSearchBehavior.js")]
…
public class ListSearchExtender : ExtenderControlBase
Hopefully this post will save others that are banging their heads against the wall with the same error.


February 27th, 2007 at 5:21 pm
Thanks, that helped
March 7th, 2007 at 12:20 am
Thanks for this post … the issue was just kinng me
March 14th, 2007 at 10:01 pm
In spanish
si el proyecto se creo con el icono ASP.NET AJAX control Project. que instala la herramienta AjaxControlExtender.vsi.
Los archivos de compilacion embedded los referencia en el archivo projectName.vbproj. si este archivo se abre con el NotePad y se busca la etiqueta
.
.
La cual se crea por defecto cuando se crea el proyecto, el problema surge cuando se va a agregar un nuevo Extender en el mismo dll. No se agrega la etiqueta adecuada.
se puede agregar una linea como, donde el js hace referencia al segundo control, tercero, etc.
Se recompila y listo se soluciona el problema
De colombia para el mundo
Juan Pablo Manrique
March 14th, 2007 at 10:03 pm
In spanish
en mi comentario anterior me elimino las etiquetas asi que va de nuevo con (:
si el proyecto se creo con el icono ASP.NET AJAX control Project. que instala la herramienta AjaxControlExtender.vsi.
Los archivos de compilacion embedded los referencia en el archivo projectName.vbproj. si este archivo se abre con el NotePad y se busca la etiqueta
(:ItemGroup:)
(:EmbeddedResource Include=”otroBehavior.js” /:)
.
.
(:/ItemGroup:)
La cual se crea por defecto cuando se crea el proyecto, el problema surge cuando se va a agregar un nuevo Extender en el mismo dll. No se agrega la etiqueta adecuada.
se puede agregar una linea como, donde el js hace referencia al segundo control, tercero, etc.
(:EmbeddedResource Include=”MyControl1Behavior.js” /:)
Se recompila y listo se soluciona el problema
De colombia para el mundo
Juan Pablo Manrique
April 11th, 2007 at 8:59 pm
hi nice site.
April 13th, 2007 at 3:28 pm
Thank you very much for this post. It helped me figure out what was happening when this same thing was occurring to me.
April 30th, 2007 at 5:14 am
Dude, in my case I was receiving an error
“…contains a Web resource with name …but does not contain an embedded resource with name …”
and the solutions was tricky but easy.
it’s quite simple, in Visual Studio 2005 just right-click the .js file and choose Properties.
On property window, locate Build Action attribute and set it to “Embedded Resource”. The problem was happining because it was accidentally to “Compile” (not by me *LOL*).
My folders are:
- MyControlToolkit (c# project)
- HelloExtender (folder)
- HelloBehavior.js (file)
- HelloDesigner.cs (file)
- HelloExtender.cs (file)
Below a piece of my source code on HelloExtender.cs:
using System;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.ComponentModel;
using System.ComponentModel.Design;
using AjaxControlToolkit;
[assembly: System.Web.UI.WebResource("MyControlToolkit.HelloExtender.OlaBehavior.js", "text/javascript")]
namespace MyControlToolkit
{
[Description("Show hello message to user")]
[Designer(typeof(HelloDesigner))]
[ClientScriptResource("MyControlToolkit.HelloBehavior", "StarjobsControlToolkit.HelloExtender.HelloBehavior.js")]
[TargetControlType(typeof(Control))]
[RequiredScript(typeof(CommonToolkitScripts), 0)]
public class OlaExtender : ExtenderControlBase {
// TODO: Add your property accessors here.
//
[ExtenderControlProperty]
[DefaultValue("")]
public string MyProperty
{
get
{
return GetPropertyValue(”MyProperty”, “”);
}
set
{
SetPropertyValue(”MyProperty”, value);
}
}
}
I hope this tip help many others over the world!
cheers,
Wander Mahet
Rio de Janeiro, Brazil
May 9th, 2007 at 10:57 am
thanks very helpful, that was the problem i had
July 5th, 2007 at 3:27 am
[...] http://damianblog.com/2007/02/22/webresource-but-no-emeddedresource/ [...]
July 19th, 2007 at 12:18 pm
Many thanks - sorted out the issue i had
October 12th, 2007 at 12:03 pm
This really really helped me. Many Thanks
November 26th, 2007 at 12:47 am
http://blogs.msdn.com/irenak/archive/2007/04/17/sysk-330-how-to-use-an-embedded-resource-from-a-sub-folder.aspx
this link help me resolve this problem
January 10th, 2008 at 11:46 am
This really really helped me. Many Thanks
July 22nd, 2008 at 11:39 am
Thanks. Fixed the problem I was having.
August 12th, 2008 at 3:40 pm
[...] trying to fix it. The first thing i did was search google, which pointed my in the direction of http://damianblog.com/2007/02/22/webresource-but-no-emeddedresource/. However this did not solve the problem in my case. The solution for me was just as simple, you [...]
December 2nd, 2008 at 11:27 pm
In my code, only the CASE of the namespace was different, but your post helped find the issue. A namespace of AJAXControlExtenders in VB is NOT the same as ‘AjaxControlExtenders’ in Javascript, and vice versa…
January 27th, 2010 at 10:44 pm
I had a similar issue but my problem wasn’t the code. It took me awhile, but the Assembly Name and Namespace Name in my Project’s Properties weren’t matching up with what I was using in the code.
(For what it’s worth, I was following a tutorial online but after creating the control, I decided to substitute names to make more sense for our application… hence, all the name discrepancy.)