您的位置:首页 > 其它

VS2012 VS2015 的项目配置模板及其目录

2016-07-15 11:59 471 查看
建立的项目多了的时候 , 就希望能自己配置好一个项目模板,以后建立的项目自动使用这个模板就省事了,不用每次都要改, 每个项目都要改了!

经不懈努力, 终于 发现了 vs2015,vs2012 (我只用了这两个,其他应该差不多方法)的项目模板的位置及更改方法了,如下:

vs菜单->视图->属性管理器->(你的项目)->(你的配置)->双击“Microsoft.Cpp.Win32.user”,弹出属性页,在里面设置VC++目录即可。这样,该设置对所有VC项目都有效。

其目录位于:%USERPROFILE%\appdata\local\microsoft\msbuild\v4.0

如图(1-1)


(图1-1)

可以每个都更改(也许你有更多的配置), 可以改:

输出目录,中间目录 这两个会自动修改所有的配置(debug/release) ;目标文件名 改的是对应的平台(win32/X64...),不能改对应的配置,如图(1-2,1-3,1-4):


(图1-2)


(图1-3)


(图1-4)

最后附上我的 配置的文件两个:

Microsoft.Cpp.Win32.user.props

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
</ImportGroup>
<PropertyGroup Label="UserMacros">
<WIN32>1</WIN32>
</PropertyGroup>
<PropertyGroup>
<OutDir>$(SolutionDir)Build\</OutDir>
<IntDir>$(SolutionDir)Temp\$(Configuration)_$(Platform)_$(ProjectName)\</IntDir>
<TargetName>$(ProjectName)</TargetName>
<IncludePath>E:\Projects\C++\Lzp_Library\;$(IncludePath)</IncludePath>
<LibraryPath>E:\Projects\C++\Lzp_Library\Build\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup>
<BuildMacro Include="WIN32">
<Value>$(WIN32)</Value>
<EnvironmentVariable>true</EnvironmentVariable>
</BuildMacro>
</ItemGroup>
</Project>


Microsoft.Cpp.x64.user.props

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
</ImportGroup>
<PropertyGroup Label="UserMacros"/>
<PropertyGroup>
<OutDir>$(SolutionDir)Build\</OutDir>
<IntDir>$(SolutionDir)Temp\$(Configuration)_$(Platform)_$(ProjectName)\</IntDir>
<TargetName>$(ProjectName)</TargetName>
<IncludePath>E:\Projects\C++\Lzp_Library\;$(IncludePath)</IncludePath>
<LibraryPath>E:\Projects\C++\Lzp_Library\Build\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup>
<BuildMacro Include="WIN32">
<Value>$(WIN32)</Value>
<EnvironmentVariable>true</EnvironmentVariable>
</BuildMacro>
</ItemGroup>
</Project>


当然你也可以还是让各个配置生成文件的到自己的目录(记得路径末尾加斜杠“\”),毕竟不能改配置的生成文件名,只能改对应平台的生成文件名:

<OutDir>$(SolutionDir)\$(Configuration)</OutDir>

还有 你也可以定义一些通用的宏 ,,,等等;

好了, 以后建立项目就简单了! ^_^
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: