few days back i have posted about the orientation aware control (OAc) , how much it is beneficial to the mobile development and other stuf.
well while working with oac i observed that , the resource names generated follow the VS naming convention as they are generated by build process. , and your source code should follow certain heirarchy, otherwise your resources will be named incorrectly. Also OAC expects all the resources to be embeded in the main assembly and file based resources will not be loaded,OAC utilizes Localization feature of .net framework, but overrides the component resrouce manager to look for resource in the main assembly only ,
for my aplication it was more desirable to have resource splitted in to culture base resources, for each resolution. after spending some time with msbuild i found that this is acheivable.
for generating proper resource names i used <LogicalName>myresourcename.resource</LogicalName>
for generating separte setallite assemblies for each resource. i added few build action
<ItemGroup>
<AvailableItemName Include=”EmbeddedResource320_240″ />
<AvailableItemName Include=”EmbeddedResource480_640″ />
<AvailableItemName Include=”EmbeddedResource640_480″ />
</ItemGroup>
then updated build action of each resoultiion related resx to its build type , like abc.320-240.resx , will have build action “EmbeddedResource320_240″ and so on
and then override the After Res Gen build event in my project file
<Target Name=”AfterResGen”>
<CreateItem Include=”@(EmbeddedResource320_240)” AdditionalMetadata=”Culture=320-240″>
<Output TaskParameter=”Include” ItemName=”OACResrouceWithCustomCulture”/>
</CreateItem>
<CreateItem Include=”@(EmbeddedResource480_640)” AdditionalMetadata=”Culture=480-640″>
<Output TaskParameter=”Include” ItemName=”OACResrouceWithCustomCulture”/>
</CreateItem>
<CreateItem Include=”@(EmbeddedResource640_480)” AdditionalMetadata=”Culture=640-480″>
<Output TaskParameter=”Include” ItemName=”OACResrouceWithCustomCulture”/>
</CreateItem>
<Message Text=”@(OACResrouceWithCustomCulture) ” />
<MakeDir Directories=”$(IntermediateOutputPath)%(OACResrouceWithCustomCulture.Culture)”/>
<GenerateResource Sources=”@(OACResrouceWithCustomCulture)” OutputResources=”@(OACResrouceWithCustomCulture->’$(IntermediateOutputPath)%(LogicalName)’)”>
<Output TaskParameter=”OutputResources” ItemName=”OACResrouces”/>
<Output TaskParameter=”FilesWritten” ItemName=”FileWrites”/>
</GenerateResource>
<AL EmbedResources=”@(OACResrouces)”
Culture=”%(OACResrouces.Culture)”
ProductName=”$(Satellite_ProductName)”
ProductVersion=”$(Satellite_ProductVersion)”
TemplateFile=”$(IntermediateOutputPath)$(TargetName)$(TargetExt)”
Title=”$(Satellite_Title)”
ToolPath=”$(AlToolPath)”
Trademark=”$(Satellite_Trademark)”
Version=”$(Satellite_Version)”
OutputAssembly= “$(IntermediateOutputPath)%(OACResrouces.Culture)\$(TargetName).resources.dll”>
<Output TaskParameter=”OutputAssembly” ItemName=”OACSatelliteAssemblies”/>
</AL>
<Copy SourceFiles=”@(OACSatelliteAssemblies)”
DestinationFiles=”@(OACSatelliteAssemblies->’$(OutDir)%(Culture)\$(TargetName).resources.dll’)”
SkipUnchangedFiles=”true”>
<Output TaskParameter=”DestinationFiles” ItemName=”FileWrites”/>
</Copy>
</Target>
problem solved
:D
i dont know the behavour when localizing control with different languages
regards

