项目无法显示“导入项目”引用的文件(System.Data.SQLite解决方案)

3

我在加载System.Data.SQLite源代码解决方案时遇到了一些问题。项目System.Data.SQLite.2010似乎是空的,实际上并不包含文件引用。但是项目文件包含以下字符串:

<Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.References.targets" />
<Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Properties.targets" />
<Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Files.targets" />

实际上,这些引用文件的内容被放在了Import Project指令中。但我的VS似乎忽略了这些指令。我是否遗漏了什么操作?或者需要安装一些插件吗?通过VS成功建立了解决方案,我只是想看到这些文件,以便更轻松地浏览源代码。


最新版本已获取,System.Data.SQLite.2010和System.Data.SQLite.Module.2010项目的所有文件都已被排除。我尝试重新包含这些文件(全部都在),但是这些项目现在一团糟,我还无法使它们构建成功。 - iCollect.it Ltd
1个回答

3
您没有缺少任何插件,VS也没有忽略Import指令。导入指令在构建项目时使用。
如果构建项目,它将正常构建,并具有可以在System.Data.SQLite*.cs中找到的所有类。
我想这样做的原因之一是为了保护“核心”框架文件免受意外修改的影响。
如果您想在解决方案文件夹中看到这些文件 -
  1. 用记事本或您喜欢的编辑器打开System.Data.SQLite.Files.targetsSystem.Data.SQLite.2010.csproj
  2. 复制两个ItemGroup节点并将其粘贴到System.Data.SQLite.2010.csproj
  3. 注释掉<Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Files.targets" />并保存csproj文件。
  4. 重新打开解决方案文件或者如果已经打开,请重新加载项目以查看这些文件。
这是我的csproj在上述修改后的样子:
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <OldToolsVersion>3.5</OldToolsVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <ConfigurationYear>2010</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\SQLite.NET.Settings.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Properties.targets" />
  <!--<Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Files.targets" />-->
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="SQLite3.cs" />
    <Compile Include="SQLite3_UTF16.cs" />
    <Compile Include="SQLiteBase.cs" />
    <Compile Include="SQLiteCommand.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteCommandBuilder.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnection.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionPool.cs" />
    <Compile Include="SQLiteConnectionStringBuilder.cs" />
    <Compile Include="SQLiteConvert.cs" />
    <Compile Include="SQLiteDataAdapter.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteDataReader.cs" />
    <Compile Include="SQLiteException.cs" />
    <Compile Include="SQLiteFactory.cs" />
    <Compile Include="SQLiteFunction.cs" />
    <Compile Include="SQLiteFunctionAttribute.cs" />
    <Compile Include="SQLiteKeyReader.cs" />
    <Compile Include="SQLiteMetaDataCollectionNames.cs" />
    <Compile Include="SQLiteParameter.cs" />
    <Compile Include="SQLiteParameterCollection.cs" />
    <Compile Include="SQLiteStatement.cs" />
    <Compile Include="SQLiteTransaction.cs" />
    <Compile Include="SR.Designer.cs">
      <DependentUpon>SR.resx</DependentUpon>
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
    </Compile>
    <Compile Include="UnsafeNativeMethods.cs" />
    <EmbeddedResource Include="SR.resx">
      <SubType>Designer</SubType>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>SR.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
    <ItemGroup Condition="'$(IsCompactFramework)' == 'false'">
    <Compile Include="SQLiteEnlistment.cs" />
    <Compile Include="LINQ\SQLiteConnection_Linq.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="LINQ\SQLiteFactory_Linq.cs">
      <SubType>Code</SubType>
    </Compile>
    <EmbeddedResource Include="SQLiteCommand.bmp" />
    <EmbeddedResource Include="SQLiteConnection.bmp" />
    <EmbeddedResource Include="SQLiteDataAdapter.bmp" />
  </ItemGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

虽然提出的解决方案显然并不能以我期望的方式解决我的问题,但至少我知道我没有错过任何Visual Studio的功能。 - Petr Abdulin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接