Same source, multiple targets with different resources (Visual Studio .Net 2008)

后端 未结 4 537
南笙
南笙 2020-12-31 07:20

A set of software products differ only by their resource strings, binary resources, and by the strings / graphics / product keys used by their Visual Studio Setup projects.

4条回答
  •  無奈伤痛
    2020-12-31 08:16

    Your approach - of using multiple, separate resource-only projects (and assemblies) - is sound, and is typical for localized apps, and in other scenarios. There are some namespace and scoping issues you need to be aware of - VS2005 always generates resource types as internal (or Friend in VB), while VS2008 allows you to vary that. You will have to do the right thing in order to be able to access multiple satellite assemblies from your main assembly -- scope the resource types publicly.

    Once you have the main DLL, and the various resource DLLs, you have options for deployment. One is to deploy the distinct DLLs separately, and load the proper one at runtime. Suppose your main EXE is called app.exe; you would then also have Sat1.dll, sat2.dll, sat3.dll,... etc, for all of the satellite assemblies. Your setup project(s) would just include whatever DLLs are appropriate.

    The other option is to merge the DLLs, with ILMerge. In this case you'd merge app.exe with sat1.dll, obtaining app1.exe. Likewise app.exe+sat2.exe => app2.exe.

    To google around on this, use "localization" and "Satellite assemblies".

提交回复
热议问题