Вы находитесь на странице: 1из 2

Creating a satellite assembly The .

NET framework uses the hub and spoke model for packaging and deploying resources. The hub is the main assembly that contains the executable code, and the resource for a single culture. This culture, called as neutral or default is the fallback culture for the application. Each spoke connects to a satellite assembly that contains the resource for a single culture, but does not contain any executable code. Steps for creating a satellite assembly Create a default resource file at the root level of the application The Resource file can be a .RESX file or .TXT file. For Example DealCalculatorUserUI is the application Name and Resource.txt is the default resource. Resource.txt is called a default resource because this is the resource file that .NET runtime will look for, if there are no language-specific resource files available. 1. Create Resource.txt file in DealCalculatorUserUI Application root folder 2. Run resource generator utility on this resource file by using the Visual Studio .NET command prompt. The command for generating a .resources file is: Resgen Resource.txt 3. This will create a binary version of the above resource file named, Resource.resources. Creating Satellite Assembly for other culture In this Example we will create Satellite Assembly for UK English culture (culture name:en-GB), in the following steps 1. Create a resource file and name this resource file as Resource.en-GB.txt 2. Run resource generator utility on this resource file by using the Visual Studio .NET command prompt. The command for generating a .resources file is: Resgen Resource.en-GB.txt 3. This will create a binary version of the above resource file named, Resource.en-GB.resources. 4. Run the AL (Assembly Linker) utility to generate a satellite assembly from the resource file generated in the previous step . The command for generating a satellite assembly looks like as below Al.exe

/t:lib /embed: Resource.en-GB.resources, MS.RIT.DealCalculator.UserUI.Resource.en-GB.resources /culture:en-GB /out:DealCalculatorUserUI.resources.dll

5. The explanation of the above command line is as below: o /t:lib: indicates that you intend to create a .dll. o /embed:Resource.enGB.resources,MS.RIT.DealCalculator.UserUI.Resource.en-GB.resources: Embeds and renames the resource to a name that matches the naming structure of Visual Studio IDE. o /culture:en-GB: Indicates the intended culture o /out:DealCalculatorUserUI.resources.dll: Indicates the name of the output DLL. The resultant DLL (DealCalculatorUserUI.resources.dll) should have the same naming convention to locate it. 6. Place the created satellite assembly in the en-GB folder inside the bin directory of your application directory. The directory structure should look like as below: \DealCalculatorUserUI\bin\en-GB\DealCalculator.resources.dll 7. Note that you may need to create the en-GB folder inside the bin directory. You can create as many satellite assemblies as you like and place them in the bin folder of your application, under respective culture-specific directories.

Вам также может понравиться