I am trying to use SMO in visual studio 2010 express. Every time I start a new project I have to hunt for the SMO DLLs via Solutions Explorer | Add Reference by browsing for them. How can I get them to show up as one of the opt开发者_运维百科ions listed by default in the .NET tab?
Better yet, how can I adjust the default console application to include the references and using statements by default when I create a new project.
If you want an assembly to show up in the .NET tab you need to install it into the Global Assembly Cache. You could then create your own Visual Studio template that includes the correct using
statements etc.
I believe for that you will need to install the SQL Server client side tools to get them to show up in the .NET of your Add Reference dialog. I know it works with VS 2008, it might with VS 2010.
To have an assembly that's not part of the framework appear in the .NET tab, you need a registry entry like
HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\ProductName
whose value is a string that names a directory like
c:\Program Files\Reference Assemblies\ProductName\
and then the reference assembly should appear in that folder.
(I am not 100% sure of the correctness of this, but I think it's right.)
Typically a software package will do that step for you, if it's a well-authored set of library components.
Regarding the second question, you'd want to create your own Visual Studio 'project template' that starts you off with those defaults (a web search will hopefully show you the steps).
精彩评论