转自:
Did you know… You can add references to your solution directly from the Object Browser - #210
一般我们添加Reference都是通过打开Sulution Explorer,在Reference文件夹或者Project节点上点击右键,选择添加引用,然后在添加引用的对话框里边选择引用。
让我们看看其它的方法怎么做: 在Object Browser的工具栏上有一个按钮叫做‘Add To References’
然后你可以看到’Accessibility’已经被添加到了工程中
转一本很好的书:http://www.yangyc.com/55fun/
转载自:Did you know… How to build a solution from the command line
建议使用Visual Studio 2005 Command Prompt来运行所有的命令
你可以从开始菜单-> 所有程序 –> Microsoft Visual Studio 2005 –> Visual Studio Tools来运行Visual Studio 2005 Command Prompt,这样你就不需要担心怎么设置正确的环境变量,比如PATH
试试输入Devenv /?
从命令行的输出,你可以看到这个命令的帮助,你需要用这些来进行编译
在命令行的帮助,你可以看到这个示例:
devenv solutionfile.sln /build solutionconfig [ /project projectnameorfile [ /projectconfig name ] ]
上边的命令可以简化为:
devenv <solutionname> /build
你同样可以制定解决方案(Solution)的配置和工程配置。你可以使用Build->Configuration Manager来创建一个新的工程和解决方案的配置来进行编译。例如:
devenv <solutionname> /build "Debug|Any CPU" /project <projectname> /projectconfig “Debug|Any CPU”
最后一点,你可以指定将编译的日志写在什么地方:
devenv <solutionname> /build "Debug|Any CPU" /project <projectname> /projectconfig “Debug:Any CPU” /out <filename>
转载自:Did you know… you can resize the statement completion window? - #059
是的,你可以往任意方向调整‘自动完成’窗口的大小:
![]()
注:
转载自:Did you know… How to use Project Templates
什么是工程模板(Project Templates)?
工程模板就是一个简单的工程,你可以使用它创建一个新的工程,比如:Windows Applications, Class Libraries, WebSites等等。对Visual Studio2005 (开发代号Whidbey)中,模板作为一个单独Zip文件存储在硬盘上。Visual Studio会默认安装一些模板在:<Program Files>\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates 和 <Program Files>\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates
对于用户(任何人)创建的模板,存储在My Documents\Visual Studio 2005\Templates. 如果你想添加一个用户创建的模板到VS的模板列表,你需要做:
1. 拷贝模板(一个模板的Zip文件)到默认的位置(针对不同VS语言版本可能不太一样)
2. 在命令行(VS的命令行)运行devenv /installvstemplates
注:貌似拷贝到My Documents\Visual Studio 2005\Templates就可以用了
Visual Studio2005也支持内含多个工程的模板,你可以到Craig’s的博客来详细了解:
http://blogs.msdn.com/craigskibo/archive/2004/10/08/240134.aspx
怎么创建用户模板?
一个最简单的方式就是使用‘导出模板向导’。首先,创建一个Class Library工程,然后给工程添加一个图标(这一步其实你可以做任何事情,你对工程做的任何改变都会保存在模板中)。然后点击菜单‘文件->到处模板。向导首先会问你是否要创建一个工程模板还是Item模板。它还会询问你希望基于那个工程来创建这个模板。下一个页面我们可以自定义我们的工程模板,我们可以修改工程模板的名称和描述,还有一个选项问你是否立即导入模板到Visual Studio中(其实也就是自动拷贝模板文件到My Documents\Visual Studio 2005\My Exported Templates to My Documents\Visual Studio 2005\Templates\Project Templates),设置好其它选项,按完成按钮,工程模板就创建好了。
.vstemplate文件中有什么?
注:当我们解压工程模板的zip包后,可以看到整个工程的所有文件,区别于正常的工程,这里多了一个.vstemplate文件,
下边我们来看一下这个文件是做什么用的
这个.vstemplate是特定于你这个工程模板的xml文件,它包含了比如模板的名称、描述等,第二部分包含了一些引用了什么文件的信息。
下边是一个典型的.vstemplate文件(我自己创建的,工程名字是AUTDefinition):
1: <VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
2: <TemplateData>
3: <Name>AUTDefinition</Name>
4: <Description>Create the AUT definitioin class library</Description>
5: <ProjectType>CSharp</ProjectType>
6: <ProjectSubType>
7: </ProjectSubType>
8: <SortOrder>1000</SortOrder>
9: <CreateNewFolder>true</CreateNewFolder>
10: <DefaultName>AUTDefinition</DefaultName>
11: <ProvideDefaultName>true</ProvideDefaultName>
12: <LocationField>Enabled</LocationField>
13: <EnableLocationBrowseButton>true</EnableLocationBrowseButton>
14: <Icon>__TemplateIcon.ico</Icon>
15: </TemplateData>
16: <TemplateContent>
17: <Project TargetFileName="UICalculator.csproj" File="UICalculator.csproj" ReplaceParameters="true">
18: <ProjectItem ReplaceParameters="true" TargetFileName="AUT.cs">AUT.cs</ProjectItem>
19: <Folder Name="Properties" TargetFolderName="Properties">
20: <ProjectItem ReplaceParameters="true" TargetFileName="AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem>
21: </Folder>
22: </Project>
23: </TemplateContent>
24: </VSTemplate>
转载翻译自:Did you know… You can drag and drop code onto the Toolbox General tab? - #191
今天的小提示很有意思,特别是如果你在给别人做演示的时候。所有的人都看到你没有写任何代码,但是实际上代码已经准备好了:),让我们看一下如何做吧: