Mono.Unix dependency is declared for net462/net48 builds too, not just netstandard2.0

Open Beginner friendly
#1,542 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
build-system

Research direction

Locate SIL.Core's own .csproj and inspect how its PackageReference items are conditioned across the target frameworks. Build or package SIL.Core, then inspect the generated nuspec: Mono.Unix should remain only in the netstandard2.0 dependency group and be absent from the .NETFramework4.6.2 and .NETFramework4.8 groups.

Written by the indexing model from the issue text.

Description

Summary

SIL.Core's published nuspec declares a dependency on Mono.Unix identically across all three target-framework dependency groups — .NETFramework4.6.2, .NETFramework4.8, and .NETStandard2.0 — even though the POSIX interop it provides is presumably only ever exercised on Linux via the netstandard2.0 build. From SIL.Core 17.0.0's nuspec:

<group targetFramework=".NETFramework4.6.2">
  ...
  <dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" exclude="Build,Analyzers" />
  ...
</group>
<group targetFramework=".NETFramework4.8">
  ...
  <dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" exclude="Build,Analyzers" />
  ...
</group>
<group targetFramework=".NETStandard2.0">
  ...
  <dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" exclude="Build,Analyzers" />
  ...
</group>

Why this matters

Mono.Unix has never had a genuinely stable NuGet release — every version ever published (including the "final" ones) carries a hyphenated suffix (e.g. 7.1.0-final.1.21458.1), which NuGet's semver parsing treats as prerelease regardless of the label. Consumers restoring via classic nuget.exe install without -Prerelease (packages.config-style restore) get "Unable to resolve dependency 'Mono.Unix'" and fail outright.

Because the dependency is declared for the .NETFramework4.6.2/.NETFramework4.8 groups too, this breaks restore for Windows-only, .NET-Framework-only consumers that never touch the Linux/netstandard2.0 build at all and have no actual runtime need for POSIX interop. This is exactly what happened downstream in sillsdev/SIL.BuildTasks#88 — SIL.BuildTasks (an MSBuild-tasks-only package with net472/netstandard2.0 targets) picked up SIL.Core 17.0.0 and broke restore for Bloom, a Windows-only consumer, purely because of this transitive dependency edge.

Suggested fix

Scope the Mono.Unix PackageReference in SIL.Core's own .csproj to only the netstandard2.0 target, e.g.:

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
  <PackageReference Include="Mono.Unix" Version="7.1.0-final.1.21458.1" />
</ItemGroup>

That would drop it from the .NETFramework4.6.2/.NETFramework4.8 dependency groups in the generated nuspec entirely, so any net46x/net48-only consumer stops needing to resolve it — without changing anything for netstandard2.0/Linux consumers, who would still need it (and would still need to work around its prerelease-only status some other way, which is a separate, harder problem this issue doesn't attempt to solve).

Dominant language
C#
Stars
46
Forks
50
Avg merge
6d 16h
Merged PRs (30d)
7

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sillsdev/libpalaso

All issues in sillsdev/libpalaso

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.