.NET .vbproj vs .sln

时间:2017-07-01 00:49:18

标签: .net vb.net

.vbproj和.sln文件有什么区别?

2 个答案:

答案 0 :(得分:2)

vbproj是单个项目的项目文件。解决方案文件可以包含许多项目,vb或其他项目,以及对解决方案文件等内容的其他引用。

您可以在文本编辑器中打开。

这是一个解决方案文件,您将看到它包含csharp和vb项目文件。它还包含在配置管理器中看到的构建的各种配置,例如调试或发布,以及这些构建的目标平台。

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cert", "cert\cert.csproj", "{BF281F9F-13B5-4F4C-BB18-96E07B3C6F8D}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "certvb", "certvb\certvb.vbproj", "{439C487E-5DA6-4998-93B5-B482A2A8C40A}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WindowsApp1", "WindowsApp1\WindowsApp1.vbproj", "{9AE70A5C-7541-407C-913D-E1B60BCB296F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp1Cs", "WindowsFormsApp1Cs\WindowsFormsApp1Cs.csproj", "{E12A5ADD-3CB2-485B-B23C-55E49BC263A7}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {BF281F9F-13B5-4F4C-BB18-96E07B3C6F8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {BF281F9F-13B5-4F4C-BB18-96E07B3C6F8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {BF281F9F-13B5-4F4C-BB18-96E07B3C6F8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {BF281F9F-13B5-4F4C-BB18-96E07B3C6F8D}.Release|Any CPU.Build.0 = Release|Any CPU
        {439C487E-5DA6-4998-93B5-B482A2A8C40A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {439C487E-5DA6-4998-93B5-B482A2A8C40A}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {439C487E-5DA6-4998-93B5-B482A2A8C40A}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {439C487E-5DA6-4998-93B5-B482A2A8C40A}.Release|Any CPU.Build.0 = Release|Any CPU
        {9AE70A5C-7541-407C-913D-E1B60BCB296F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {9AE70A5C-7541-407C-913D-E1B60BCB296F}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {9AE70A5C-7541-407C-913D-E1B60BCB296F}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {9AE70A5C-7541-407C-913D-E1B60BCB296F}.Release|Any CPU.Build.0 = Release|Any CPU
        {E12A5ADD-3CB2-485B-B23C-55E49BC263A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {E12A5ADD-3CB2-485B-B23C-55E49BC263A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {E12A5ADD-3CB2-485B-B23C-55E49BC263A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {E12A5ADD-3CB2-485B-B23C-55E49BC263A7}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

另一方面,项目文件本身是xml,包含解决方案中单个项目的设置,参考,文件和其他信息:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{439C487E-5DA6-4998-93B5-B482A2A8C40A}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <StartupObject>certvb.Module1</StartupObject>
    <RootNamespace>certvb</RootNamespace>
    <AssemblyName>certvb</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MyType>Console</MyType>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <DocumentationFile>certvb.xml</DocumentationFile>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <DefineDebug>false</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DocumentationFile>certvb.xml</DocumentationFile>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OptionExplicit>On</OptionExplicit>
  </PropertyGroup>
  <PropertyGroup>
    <OptionCompare>Binary</OptionCompare>
  </PropertyGroup>
  <PropertyGroup>
    <OptionStrict>Off</OptionStrict>
  </PropertyGroup>
  <PropertyGroup>
    <OptionInfer>On</OptionInfer>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\cert\BouncyCastle.Crypto.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Numerics" />
    <Reference Include="System.Web.Extensions" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.Net.Http" />
  </ItemGroup>
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Diagnostics" />
    <Import Include="System.Linq" />
    <Import Include="System.Xml.Linq" />
    <Import Include="System.Threading.Tasks" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="ChainDownloader.vb" />
    <Compile Include="Module1.vb" />
    <Compile Include="My Project\AssemblyInfo.vb" />
    <Compile Include="My Project\Application.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Application.myapp</DependentUpon>
    </Compile>
    <Compile Include="My Project\Resources.Designer.vb">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="My Project\Settings.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="My Project\Application.myapp">
      <Generator>MyApplicationCodeGenerator</Generator>
      <LastGenOutput>Application.Designer.vb</LastGenOutput>
    </None>
    <None Include="My Project\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <CustomToolNamespace>My</CustomToolNamespace>
      <LastGenOutput>Settings.Designer.vb</LastGenOutput>
    </None>
    <None Include="App.config" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="BouncyCastle.Crypto.dll" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

答案 1 :(得分:0)

.sln 是您的解决方案。它可以包含多个项目。

虽然

.vbproj 是您的项目。它包含项目所需的文件。