Reputation: 125
Is there a way to set the namespaces references for all files within a folder?
Example: All my classes in a certain folder needs to reference System.ComponentModel
(and many others) and I don't want to set the references every time I create a new class.
Upvotes: 0
Views: 285
Reputation: 27974
No, this is not possible. Each file represents a separate compilation unit and the C# language specification states:
A C# program consists of one or more compilation units, each contained in a separate source file.
…
The using_directives of a compilation unit … have no effect on other compilation units.
As others suggested, development tools that integrate with Visual Studio are typically used to perform such routine tasks as generating and maintaining the set of using
s in each file.
Upvotes: 1