【Visual Studio】关于*.sln *.vcxproj *.vcxproj.filters *.vcxproj.user的简单理解


*.sln

  • microsoft官方说明
  • 可以理解为“解决方案文件”,里面包含了很多项目。
  • 其中记录了可以打开vs的版本号和一些全局变量信息的额加载。

*.vcxproj

  • C++技术网
  • 工程文件vcxproj是将工程中的所有文件和配置信息都记录在一起形成整体的文件。
    包含了一些include path、SourcePath和LibraryPath这些信息,随便插一段代码感受一下:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <ItemGroup Label="ProjectConfigurations">
   <ProjectConfiguration Include="Debug|x64">
     <Configuration>Debug</Configuration>
     <Platform>x64</Platform>
   </ProjectConfiguration>
   <ProjectConfiguration Include="Release|x64">
     <Configuration>Release</Configuration>
     <Platform>x64</Platform>
   </ProjectConfiguration>
 </ItemGroup>
 <PropertyGroup Label="Globals">
   <ProjectGuid>{B12702AD-ABFB-343A-A199-8E24837244A3}</ProjectGuid>
   <Keyword>Qt4VSv1.0</Keyword>
   <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
 </PropertyGroup>
 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
   <ConfigurationType>Application</ConfigurationType>
   <PlatformToolset>v141</PlatformToolset>
   <CharacterSet>MultiByte</CharacterSet>
 </PropertyGroup>
 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
   <ConfigurationType>Application</ConfigurationType>
   <PlatformToolset>v141</PlatformToolset>
   <CharacterSet>MultiByte</CharacterSet>
 </PropertyGroup>
 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
 <PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">
   <QtMsBuild>$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
 </PropertyGroup>
 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   <OutDir>bin\$(Platform)\$(Configuration)\</OutDir>
   <IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
   <IncludePath>Navi2D\headers;headers;wvtk\headers;$(IncludePath)</IncludePath>
   <SourcePath>sources;wvtk\srources;$(SourcePath)</SourcePath>
   <ExecutablePath>$(ExecutablePath)</ExecutablePath>
   <LibraryPath>$(LibraryPath)</LibraryPath>
   <LibraryWPath>$(WindowsSDK_MetadataPath)</LibraryWPath>
 </PropertyGroup>

.vcxproj.filters

.vcxproj.user

  • user是本地化用户配置,允许多个用户使用自己喜好的方式配置这个项目(例如打开项目时候窗体位置等与项目内容无关的配置)

Visual Studio项目移植

vs还是比较适合用于大型项目的开发,对于一般的脚本项目还是用cmakelists方便一些!
在使用visual studio进行开发的时候常常还会伴随着移植时带来的问题。

  • 对库的处理:将库clone到固定目录,然后通过硬链接到sln目录下。

使用命令提示符:
cd /d Solution Dir
mklink /D <文件夹名> <你本地的仓库路径>

touch .gitignore
/ *.sln
/ obj
/ bin
/ <依赖仓库>
/ *.vcxproj.user
/ *.vcxproj.filters
/ *.vcxproj
/.vs

  • 之后*.sln *.vcxproj *.vcxproj.filters *.vcxproj.user 这些文件可以互相传递。

【参考】

  • 18
    点赞
  • 51
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值