10. februar 2009 02:22 lea

Spreading common skin files for ASP.NET 2.0 to ease theme images

I've been sure the ASP.NET theme framework fixed the url's of pictures with equal paths under the application as the themes.
Looks like it doesn't. The only way to theme images is to have a skin file in each theme.

Why would I want to duplicate SkinID="thisImage" ImageUrl="Images/ThisImage.gif" for all my themes if the images are named the same?

The solution is batch files.

Having the following bat file in my solution dir, I can spread a common skin file containing image urls to all my themes:

for /f "delims=" %%i in ('dir "%~1App_Themes" /ad/b') do copy "%~1App_Themes\Images.skin" "%~1\App_Themes\%%i\Images.skin"

now I just run "$(SolutionDir)\SpreadSkin.bat" "$(ProjectDir)" in my pre build even and I've got the skin file in all theme folders.

Filed under: , ,

Comments

No Comments