开发者

Problem in understanding assembly, and resources from a different assembly

开发者 https://www.devze.com 2023-04-03 10:37 出处:网络
The book is WPF Unleashed, and it tells that binary resources from a different assembly can be used as well, but what it doesn\'开发者_StackOverflow社区t explain is the concept of assembly and the nee

The book is WPF Unleashed, and it tells that binary resources from a different assembly can be used as well, but what it doesn'开发者_StackOverflow社区t explain is the concept of assembly and the need to pack resources in a different assembly. So i put the question here.

I tried to google it, but couldn't find the answer that allows me to comprehend what is an assembly in WPF, and how to create an assembly that just consist of resources using Visual Studio 2010?

And second, what is the advantage of packing resources in a different assembly except that they can be updated without shipping a brand new assembly of the product.


WPF assemblies are no different than any other .NET assembly in terms of structure and use. They are the fundamental unit of deployment of an application (web, windows, service, etc) and contain resources for the execution of a .NET application.

I'd take a look at the MSDN article on assemblies -- it's pretty straightforward.

As for your second question, I'll repeat my comment here. You already answered your question about packing resources in a separate assembly -- you can redeploy that separate assembly without having to redeploy or rebuild your original product. You gotta like that. Being able to drop in to your bin directory an assembly that has, say, a bunch of custom widgets that you want to display on your site and having your site automatically probe the bin directory and grab all of the resources that meet its criteria is wonderful. I don't end up having to touch my main app -- just create a new project for my new resources, compile it to a separate assembly (DLL in this case) and just drop it in 'bin' and voila! Awesome.

Hope this helps.


Here's a starting point:

wiki on .NET Assemblies

An Assembly is similar to a C++ DLL, but it has some other characteristics, such as metadata which describes the classes that are available for use.

One advantage of packing resources in a different assembly is that it gives a single point of reference - if you need to reuse resources across an application (or many applications) that use multiple assemblies, then this is a good strategy to adopt. This is particularly useful if those resources need to be localized.

WPF does not define assemblies, the concept is defined across the .NET Framework.

0

精彩评论

暂无评论...
验证码 换一张
取 消