Last post Feb 26, 2007 02:51 PM by bdemarzo
Oct 31, 2006 10:15 PM|Padgett|LINK
I’d like to make a suggestion in regards to how this project is packaged.
This is aimed at those who want to add Css based controls to their existing project and are not concerned with how it all works.
In addition to your source and example packages, I’d love to see a ‘redistributable’ package.
This would contain just the elements needed to override the rendering of the controls.
I see this as being:
A single dll with which to reference in our existing projects.
This dll contains all the code and resources for the control adapters.
A .browser file that tells our projects to use the control adapters in the referenced assembly
Is this do-able?
Overall this project is excellent.
In my opinion this is how the asp.net controls should have been built in the first place.
Nov 01, 2006 11:25 AM|Russ Helfand|LINK
This is a great idea. I know of a few people who have already implemented it. I'll contact one of them, Polita Paulus, who is part of the ASP.NET team, to see if she can post some notes on how exactly to do this packaging yourself.
I understand that you'd prefer for MS to do this DLL construction for you and merely distribute it in a future rev of the kit. I'll keep that in mind but Polita's (or others') recipe for how to do this can help you and others right now. So, let's try to
get a detailed set of instructions posted here if we can.
Again, thanks for the insight on how you'd prefer the kit packaged. It's a good idea.
Nov 01, 2006 04:08 PM|HardyE|LINK
For the release of the Blinq prototype I compiled the necessary adapter resources into a dll to keep the project files clear of unrelated adapter code so developers would be able to concentrate
on the core Blinq files. The CSS Adapters were in an early stage at the time but the principle can just as well be applied to the current release.
The way to go about "pre-packaging" the adapters resources into a single dll is as follows:
1. Create a class-library project in Visual Studio. Name it "CSSAdapters". This will hold the resources and code files which will eventually be turned into the dll.
2. Add a "CSS Friendly ASP.NET Control Adapters" web site to the solution in Visual Studio.
3. Reference the class library project from the Adapters project. This will ensure the output of the class library project will be copied to the Adapter project's "bin" directory.
4. Move (don't copy) the following folders and their contents from the Adapters project to the dll project:
The .cs/.vb files can be moved to the root directory of the class library project, but I recommend leaving the .css and .js files in their respective folders. The steps below assume this is the case.
5. Open the file "AssemblyInfo.cs" of the class library project. You will need add to this file in the next step.
a) Select a file in Solution Explorer.
b) In the properties window set its build action to "Embedded Resource".
For CSS files the format would be:
[assembly: WebResource("CssAdapters.CSS.Menu.css", "text/css")]
7. Now adjust the C#/VB code in the adapter classes to retrieve the resources from the assembly instead of the file system. The method you need here is
ClientScriptManager.GetWebResourceUrl , which which you could use as follows:
Use this call to GetWebResourceUrl() anywhere a file system path to the respective resource is required by the adapter class.
Hint: the tricky part in making embedded resources work is to figure out the exact value for the first parameter of WebResourceAttribute . If you get the casing wrong, retrieval of the resource will fail silently. No exception will be thrown, the file is simply not served. A helpful method to figure out the correct string for the resource is to set the build action for all the resources to "Embedded Resource" as in step 6b and then compile the dll. Then open the dll you just compiled in ildasm.exe and double-click on the "MANIFEST" section. Somewhere you will find entries that look similarly to this:
.mresource public CSSAdapters.CSS.Menu.css
// Offset: 0x00000E50 Length: 0x000006F7
The value after .mresource public is the precise string you have to pass to the WebResourceAttribute in step 6c.
Further reading on embedded resources in ASP.NET 2.0:
Nov 01, 2006 08:12 PM|Padgett|LINK
Nov 16, 2006 10:42 AM|bdemarzo|LINK
"css friendly adapter"
Nov 16, 2006 07:00 PM|Thacker|LINK
Your compiled dll and supplied files within your zip are excellent. This will greatly ease deployment. Re-compiling the dll for adjustments and later revisions to the adapters and associated files is going to be a breeze. It keeps things simple and stupid.
It is great. Thanks very much, ladies and gentlemen.
Nov 16, 2006 10:01 PM|bdemarzo|LINK
Thanks for the kind words -- I'm glad you (and hopefully many others!) find it as helpful as I do. I'll keep updating the compiled distribution to coincide with the latest changes from Microsoft until they do it for me. [;)]
Jan 29, 2007 04:23 AM|michiel1978|LINK
your site is currently down, is this temporary? If not, would you consider moving the project to sourceforge or codeplex so we always have access and others can help with the maintenance?
Jan 29, 2007 10:15 AM|bdemarzo|LINK
My server crashed and I haven't had time to repair it. Should be back in a week or so.
I will look into adding it to CodePlex this week.
Jan 30, 2007 03:08 PM|michiel1978|LINK
Jan 30, 2007 03:16 PM|bdemarzo|LINK
Just realized you might not be allowed to post the source to Codeplex
because you altered it (Microsoft Permissive License)?
Good point. ScottGu commented on my posting of the compiled adapters, which means he's familiar with what I did (and supportive of it). I'll ask him if he has suggestions.
Feb 26, 2007 02:51 PM|bdemarzo|LINK
For those still interested in this, there's a few developments...
CSS Control Adapters