Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight resource dll build prevention

When you build a silverlight application, it always outputs a whole bunch of localization resource dlls into \bin\de\ \bin\es\ \bin\fr\ etc (which can end up packaged in the .xap). This is wonderful but I'm not using these, they aren't required for the app to operate and they are cluttering up the root of our TFS build server.

I realise there's a little bug with TFS 2K8 which is easily fixable to ensure these files don't get dumped in the build server's root, however what I would ideally like is to PREVENT these files from ever being generated.

I've tried everything under the sun to stop these files from being created. Because they don't actually exist until build time, I can't tell them to not output.

I've found tons of information on localization / globalization, how these files work and lots of ways to manipulate them, but nothing on preventing them building in the first place.

Does anyone know of a way that I can stop these from appearing in \bin\ on build ? Is there an switch I can use in the build options or something similar?

Edit. I want a way to PREVENT this happening. It can be cleaned up with post-build events but that is far from ideal.

like image 353
pezi_pink_squirrel Avatar asked Feb 18 '09 18:02

pezi_pink_squirrel


2 Answers

I answered this in another StackOverflow thread: Language folders for Silverlight projects when building with Team Build

Open Windows Explorer. Go to C:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client. (C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\ if you're running 64-bit Windows). In that location, you will see a bunch of language/culture folders.

  • Create a new folder. I named mine "Unused Cultures."
  • Move all the culture folders that you do not want to use to the the new folder. Be sure NOT to move the "Design" folder, which appears in the middle of the culture folders in the folder list.
  • In your project, delete the contents of the Bin, Release, etc. folders. Rebuild.
  • When you want to add support for another culture, just move the one you want back to the original location.

Whenever you get an update to the Silverlight SDK, you will probably have to do this again.

like image 168
D'Hag Avatar answered Oct 19 '22 02:10

D'Hag


If you look in those folders after you build your project you will see a bunch of dlls and/or resource files in them. The dlls/resources you see in the folder are what are causing the folders themselves to be generated. Since you are referencing these dlls in your project, when you build the project the reference grabs those files from the SDK folder (or wherever they are referenced from).

So, as an example, if you look at the System.Windows.Controls.dll which will be installed in the %ProgramFiles%\MicrosoftSDKs\Silverlight\v3.0\Libraries\Client folder. In that folder you will see the same folders that get generated when you build (de,fr,it,etc). So to keep those from being generated you can do a couple of things.

1) Copy the dll to a seperate folder and reference that file. I had to actually remove the dll from the sdk folder for the reference to work in VS 2010, not sure if just the reference will be fixed in 2008.

2) Rename or remove the global folders and files from the SDK itself. This would affect all the projects, not just your single project, but it may solve the issue for you.

Good luck!

like image 38
Bryant Avatar answered Oct 19 '22 03:10

Bryant