【问题标题】:.NET SDK project type reference issue.NET SDK 项目类型参考问题
【发布时间】:2018-08-08 02:36:46
【问题描述】:

我的新样式 .csproj 中有这个:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net461</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
  <ItemGroup>
    <Reference Include="System.Data.SqlServerCe">
      <HintPath>..\OtherProject\System.Data.SqlServerCe.dll</HintPath>
    </Reference>
  </ItemGroup>

</Project>

但 VS 一直在解析对以下内容的引用:

C:\Users\Me\.nuget\packages\microsoft.sqlserver.compact\4.0.8876.1\lib\net40\System.Data.SqlServerCe.dll

但这是错误的汇编版本(文件系统中的那个是4.0.0.1,nuget的是4.0.0.0)

我需要向我的 csproj 添加什么?

【问题讨论】:

  • Hmya,程序员太喜欢新的项目格式了。它的 IDE 和 MSBuild 工具有很长的错误列表,而且它并没有变小。提示路径是on that list as well。当你在罗马时,最好说意大利语,他们会理解 PackageReference。
  • 我想我现在会切换回旧的 csproj 格式
  • 你能用4.0.8854.1吗?如果是这样,则有一个 nuget 包。我总是依赖 nuget 包而不是硬引用。无论如何,将二进制文件提交到 git 并不是很好。

标签: .net visual-studio visual-studio-project


【解决方案1】:

请尝试在&lt;Reference&gt; 标记中指定Version=4.0.0.1 或您想要的任何版本:

<Reference Include="System.Data.SqlServerCe, Version=4.0.0.1">
  <HintPath>..\OtherProject\System.Data.SqlServerCe.dll</HintPath>
</Reference>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-22
    • 2017-11-07
    • 2011-01-18
    • 1970-01-01
    • 1970-01-01
    • 2011-05-17
    • 1970-01-01
    • 2020-05-14
    相关资源
    最近更新 更多