在共享项目中使用 MongoDb.Bson 时"Duplicate 'Content' items were included" MongoDb.Driver 2.14.1 (.Net SDK 6



使用mongodb NuGets:的项目设置

  • 使用MongoDb的后端项目。Driver&MongoDb.Driver.Core
  • 与Mongodb.Bson共享项目(后台引用!(

在将nugets从2.13.3更新到2.14.1后,我收到以下构建错误:

Microsoft.NET.Sdk.DefaultItems.Shared.targets(213, 5):[NETSDK1022] Duplicate 'Content' items were included.
The .NET SDK includes 'Content' items from your project directory by default.
You can either remove these items from your project file, or set the 'EnableDefaultContentItems' property to 'false' if you want to explicitly include them in your project file.
For more information, see https://aka.ms/sdkimplicititems.
The duplicate items were:
'C:Users**.nugetpackagesmongodb.driver.core2.14.1build..runtimeswinnativelibzstd.dll'
'C:Users**.nugetpackagesmongodb.driver.core2.14.1build..runtimeswinnativesnappy32.dll'
'C:Users**.nugetpackagesmongodb.driver.core2.14.1build..runtimeswinnativesnappy64.dll'
'C:Users**.nugetpackagesmongodb.driver.core2.14.1build..runtimeslinuxnativelibsnappy64.so'
'C:Users**.nugetpackagesmongodb.driver.core2.14.1build..runtimeslinuxnativelibzstd.so'
'C:Users**.nugetpackagesmongodb.driver.core2.14.1build..runtimesosxnativelibsnappy64.dylib'
'C:Users**.nugetpackagesmongodb.driver.core2.14.1build..runtimesosxnativelibzstd.dylib'

回滚到2.13.3解决了问题。这是一个bug吗,或者有人知道这里出了什么问题吗?

似乎解决它的第一个版本是2.18.0

确认至少从2.18.0版本;包含重复的"内容"项目";已修复。

因此,如果有人也将<EnableDefaultContentItems>false</EnableDefaultContentItems>添加到项目文件中,您现在可以/应该将其删除。

最新更新