Sicos1977 / MsgKit

A .NET library to make MSG files without the need for Outlook
199 stars 55 forks source link

Resolve "Duplicate 'PackageReference' items found." #115

Closed jamesjohnmcguire closed 10 months ago

jamesjohnmcguire commented 10 months ago

In the MsgKit.csproj project file, there is following sections:

  <ItemGroup Condition=" '$(TargetFramework)' == 'net462'">
    <PackageReference Include="MimeKit" Version="2.10.1" />
    <PackageReference Include="OpenMcdf" Version="2.2.1.9" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
    <PackageReference Include="MimeKit" Version="2.6.0" />
    <PackageReference Include="OpenMcdf" Version="2.2.1.4" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="MimeKit" Version="4.2.0" />
    <PackageReference Include="OpenMcdf" Version="2.3.0" />
    <PackageReference Include="System.Memory" Version="4.5.5" />
  </ItemGroup>

Notice that MimeKit and OpenMcdf are referenced twice for each target. This causes the following build warnings:

Warning NU1504  Duplicate 'PackageReference' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageReference' items are: MimeKit 2.10.1, MimeKit 4.2.0; OpenMcdf 2.2.1.9, OpenMcdf 2.3.0.  MsgKit.csproj   1   

Warning NU1504  Duplicate 'PackageReference' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageReference' items are: MimeKit 2.6.0, MimeKit 4.2.0; OpenMcdf 2.2.1.4, OpenMcdf 2.3.0.   MsgKit.csproj   1   

It isn't clear to me which packages are the actual intended packages to use (Especially since they are using different versions). But it would be nice to remove unintended references and thus remove the build warnings as well.

This is not an urgent issue.

Sicos1977 commented 10 months ago

I always try to update to latest nuget packages versions when I edit something in MsgKit. It is that you mentioning this issue because I never have seen it when compiling the code.

jamesjohnmcguire commented 10 months ago

The warnings show up (for me) when running: dotnet build MsgKit.sln

Also, inside Visual Studio 'Build'

Sicos1977 commented 10 months ago

Solved