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

发布于 2024-11-16 14:13:13 字数 643 浏览 2 评论 0原文

我在加载 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" />

实际上,其中包含对文件的引用。但看起来我的 VS 忽略了这个 Import Project 指令。有什么我想做的事吗?或者也许我需要安装一些插件?解决方案已从 VS 成功构建,我只想查看文件,以便可以更轻松地在源代码上导航。

I have some trouble with loading a System.Data.SQLite source solution. The System.Data.SQLite.2010 project seems to be empty, it is, indeed, does not contain references to files. However project file contains strings like these:

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

which, actually, contain references to files. But it's looks like this Import Project instructions are ignored by my VS. Is there is something I miss to do? Or maybe I need some plugin to install? Solution is builded successfully from VS, I just want to see files so I can navigate more easily on source.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明媚如初 2024-11-23 14:13:13

您没有丢失任何插件,VS 也没有忽略 Import 指令。构建项目时使用导入指令。

如果您构建该项目,它会构建得很好并且具有可以在 System.Data.SQLite*.cs 中找到的所有类。

我想这样做的原因之一是为了保护“核心”框架文件免遭意外修改。

如果您想在解决方案文件夹中查看这些文件 -

  1. 在记事本中打开 System.Data.SQLite.Files.targetsSystem.Data.SQLite.2010.csproj或您最喜欢的编辑器
  2. 复制两个 ItemGroup 节点并将其粘贴到 System.Data.SQLite.2010.csproj
  3. 注释掉 并保存 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>

You're not missing any plugins, nor is VS ignoring the Import directives. The import directives are used when build the project.

If you build the project, it builds fine and has all the classes that can be found in System.Data.SQLite*.cs.

I guess one of the reasons why this was done to protect 'core' framework files from accidental modification.

If you would like to see those files in your solution folder -

  1. Open up System.Data.SQLite.Files.targets and System.Data.SQLite.2010.csproj in notepad or your favorite editor
  2. Copy both ItemGroup nodes and paste them in System.Data.SQLite.2010.csproj
  3. Comment out <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Files.targets" /> and save the csproj file.
  4. Open up the solution file again or if already opened, reload the project to see the files.

Here's what my csproj looks after above modification:

<?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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文