Question

I'm working on app which uses a lot of external assemblies (newtonsoft.dll, Yahoo Yui compressor.dll, fleck.dll etc). In each c# file I need to add using statement with all those assemblies. Is it possible to create my own assembly (i.e. LIBRARY.dll) containing all the dll's and refer only to this in all c# files?

Was it helpful?

Solution

No. Firstly, using directives refer to namespaces, not assemblies (assembly references are defined at the project level). Secondly: you almost certainly don't actually need all of them in every file. But: you can create a new-file-template with the ones you are likely to need. But frankly it is usually easier to either copy/paste them, or just add them when they are needed. In the IDE, this is as simple as pressing ctrl+.,ret after a type name that doesn't resolve... so MySpecialTypectrl+.,ret should add the missing using directive to resolve MySpecialType.

OTHER TIPS

using does not refer to assembly, but to namespace. So the answer is "no"...

using System; // you are using items in the System namespace
using System.IO; // you are using items in the System.IO namespace

No. Usages of individual types need to be resolved to the namespaces where they are defined in. So, you will still need to include the resolution paths in your usings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top