Monday, December 26, 2011

Batch program for creating satellite assembly

Annotated Batch Program For Creating a Satellite Assembly From a Directory's Worth of Resource Files


@rem****************************************************************************
@rem* Batch file for generating a satelite assembly
@rem* from a directory full of .resx files
@rem*
@rem* inputs
@rem* %1: language: hi-IN
@rem* %2: Your application name: SKLocalizationSample
@rem*
@rem* output:
@rem* will create SKLocalizationSample.resources.dll
@rem* in the same directory
@rem*
@rem****************************************************************************


@rem**************************************************
@rem* Set path for resgen.exe and al.exe
@rem**************************************************

@set path=%path%;
"C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin";
c:\winnt\microsoft.NET\framework\v1.0.3705


@rem**************************************************
@rem* Convert all .resx files to .resources files
@rem**************************************************
@del *.resources
@for %%f in (*.resx) do @resgen %%f

@rem**************************************************
@rem* Create text based command file for each resourc
@rem**************************************************

@rem del a.txt
@echo /t:lib > a.txt
@for %%f in (*.resources) do @echo /embed:%%f,%2.resources.files.%%f >> a.txt
@echo /culture:%1 >> a.txt @echo /out:%2.resources.dll >> a.txt

@rem**************************************************
@rem*
@rem* The generated input command file a.txt will look like this
@rem*
@rem* /t:lib
@rem* /embed:CommonResources.hi-in.resources,
@rem* SKLocalizationSample.resources.files.CommonResources.hi-in.resources


@rem* /embed:Common1Resources.hi-in.resources,
@rem* SKLocalizationSample.resources.files.Common1Resources.hi-in.resources


@rem* /embed:Common2Resources.hi-in.resources,
@rem* SKLocalizationSample.resources.files.Common2Resources.hi-in.resources


@rem* /embed:Common3Resources.hi-in.resources,
@rem* SKLocalizationSample.resources.files.Common3Resources.hi-in.resources


@rem* /culture:hi-in
@rem* /out:SKLocalizationSample.resources.dll
@rem*
@rem* Feed this file to al.exe
@rem**************************************************


@rem****************************
@rem* Create the satelite assembly
@rem****************************
del %2.resources.dll
al @a.txt

No comments:

Post a Comment