Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2007

Tip: Looking for answers? Try searching our database.

AssemblyResource not found

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chuck P - 29 Jun 2007 17:42 GMT
I have an embedded js resource in my Assembly asp.net 2.0

In the immediate Window I do:

((System.Web.UI.WebResourceAttribute)Attribute.GetCustomAttributes(Asm)[7])
{System.Web.UI.WebResourceAttribute}
   base {System.Attribute}: {System.Web.UI.WebResourceAttribute}
   ContentType: "application/x-javascript"
   PerformSubstitution: false
   WebResource: "Util.Ctrl.GridView.GridViewCheckBox.js"

and

Asm.GetManifestResourceInfo("Util.Ctrl.GridView.GridViewCheckBox.js")
null

Shouldn't I be getting something other than null???

my AssemblyInfo.cs contains:
[assembly: WebResource("Util.Ctrl.GridView.transparent.gif", "img/gif")]
[assembly: WebResource("Util.Ctrl.GridView.GridViewCheckBox.js",
"application/x-javascript")]

Asm.GetManifestResourceInfo("Util.Ctrl.GridView.transparent.gif")
{System.Reflection.ManifestResourceInfo}
   FileName: null
   ReferencedAssembly: null
   ResourceLocation: Embedded | ContainedInManifestFile

The gif and the js files are in the same directory!
Walter Wang [MSFT] - 02 Jul 2007 10:49 GMT
Hi Chuck,

I'm not sure, would you please check if the build action of the .js file is
also set to "Embedded resource" as the .gif file? Please note, the naming
of the webresource should be composed of three parts: default namespace +
subdirectory path + file name.

For example, if your assembly has default namespace "ClassLibrary1", and
the GridViewCheckBox.js is located at a subdirectory "test", the web
resource name should be "ClassLibrary1.test.GridViewCheckBox.js".

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Chuck P - 10 Jul 2007 22:54 GMT
Walter,
I did mess up and forgot to put the js file as an embedded resource.
However,

If I have the file in project directory at:

Util\Ctrl\GridView\GridViewCheckBox.js
and the assembly as
[assembly: WebResource("Util.Ctrl.GridView.GridViewCheckBox.js",
"application/x-javascript")]

everything works fine.

However if I move the file to:
Util\Ctrl\GridView\checkBox\GridViewCheckBox.js
and the assembly as:
[assembly: WebResource("Util.Ctrl.GridView.checkBox.GridViewCheckBox.js",
"application/x-javascript")]

it doesn't find it.

The project namespace is Util
The control which loads the embedded resource is in namespace
Util.Ctrl
Walter Wang [MSFT] - 11 Jul 2007 03:06 GMT
Hi Chuck,

Is the root/default namespace "Util.Ctrl"? and the directory in the project
starts with "GridView\checkbox\GridViewCheckBox.js"?

It's strange that it cannot find the resource. Can you send me a
reproducible project for further troubleshooting? Thanks.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Walter Wang [MSFT] - 12 Jul 2007 06:54 GMT
Hi Chuck,

Thanks for the code.

I've done some test using your code:

1) Move GridViewCheckBox.js into its subfolder checkBox
2) Modify AssemblyInfo.cs to use:

[assembly: WebResource("Util.Ctrl.GridView.checkBox.GridViewCheckBox.js",
"application/x-javascript")]

3) Modify GridView_Ex.CheckBox.js:

private const string CheckBoxJsResourceLocation =
"Util.Ctrl.GridView.checkBox.GridViewCheckBox.js";

4) After I rebuilding the Ctrl.dll, I used a console program to test it and
it works correctly.

I suggest you rebuilding your project, of even re-add the reference if
necessary.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Chuck P - 12 Jul 2007 15:40 GMT
thanks,
I had to go into the test project, remove the reference to the util class
and then add it back before it would work.  Just deleting the dll didnt work.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.