bfops
bfops

Reputation: 5678

Static linking in C#?

The Windows Azure client libraries are very big (several MBs), and I have a fairly small project (on the order of a few hundred KBs) that uses only a few functions from them. Is there a way for me to link in those functions at build time, so that the resultant DLL doesn't get hugely bloated, and I don't have to link the functions in at runtime?

Something like this http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx, but I get the impression that bundles in the whole DLL.

Thanks!

Edit: Because there are external constraints on the size of the final deliverable DLL, inflating it this much is an absolute last resort - the only other option I'm aware of is just to duplicate the code I use verbatim.

Upvotes: 6

Views: 179

Answers (2)

Michal Levý
Michal Levý

Reputation: 37833

What you are looking for sounds very like .NET Native. Unfortunately for you, its only preview and right now works only with Store Apps for devices. Statements like this

We will continue to evolve and improve native compilation for the range of .NET applications

can be found on the internet but nothing specific about web apps\Azure.

Until then, answer is No

Upvotes: 3

BradleyDotNET
BradleyDotNET

Reputation: 61369

In a word: No.

Remember that even though you only use a few functions, there are likely many other function in the library that those functions use, that you don't even know about!

You can't do this, because you don't have access to all the dependencies. Remember also that those dependencies may even reside in another DLL, and you need to include that entire DLL for the same reason.

Upvotes: 5

Related Questions