VS 2008 and "using" in a new class
-
This should hopefully be pretty straight forward: Is there a way to configure VS 2008 so that whenever I add a new class file, i can customise the "using" declarations at the top automatically? For instance, I have a project where literally every class has this: "using System.Data.Linq;". Can i configure VS to add that by default when i create a file, just like it already adds "using System;"? I know its not hard at all to add them manually every time, but it is annoying sometimes to do a lengthy build only to find i forgot to add a declaration and have to wait for it to build over again. Thank you :)
______________________ Oh Hamburgers!
-
This should hopefully be pretty straight forward: Is there a way to configure VS 2008 so that whenever I add a new class file, i can customise the "using" declarations at the top automatically? For instance, I have a project where literally every class has this: "using System.Data.Linq;". Can i configure VS to add that by default when i create a file, just like it already adds "using System;"? I know its not hard at all to add them manually every time, but it is annoying sometimes to do a lengthy build only to find i forgot to add a declaration and have to wait for it to build over again. Thank you :)
______________________ Oh Hamburgers!
Vodstok wrote:
but it is annoying sometimes to do a lengthy build only to find i forgot to add a declaration and have to wait for it to build over again.
Are you using VS 2008 SP1? Does C#'s auto-syntax errors feature pick up missing usings? BTW, you can insert usings as you type using the smart tag (Alt+Shift+F10). That helps to keep the missing usings to a minimum.
Kevin
-
Vodstok wrote:
but it is annoying sometimes to do a lengthy build only to find i forgot to add a declaration and have to wait for it to build over again.
Are you using VS 2008 SP1? Does C#'s auto-syntax errors feature pick up missing usings? BTW, you can insert usings as you type using the smart tag (Alt+Shift+F10). That helps to keep the missing usings to a minimum.
Kevin
-
This has not answered the question. The OP is asking if we can customise what default usings get set for a new class when it is created. I would also like to know this as we also don't use linq!
It can't be customised as far as I know. But I was suggesting a workaround. If C# 2008 SP1 does add the red squigglies then at least you can spot the missing usings as you're going along and invoke them using that keyboard shortcut. I don't know if third party tools such as Resharper can add in missing usings.