fsprojects / fsprojects/Paket

Exclude Paket incorporated analyzers from dotnet pack

Open
#4,179 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

In a reasonable VS solution, we use Paket to manage all our dependencies including some Roslyn-based analyzers. Some of our C# projects are also packed and published as NuGet packages for other clients. This process is triggered via dotnet pack.

Unfortunately, the dependencies on the analyzers are also stated in the package metadata; therefore, these analyzers get incorporated in client projects where they are not wanted.

We found some advice with the copy_local: true|false directive. But it makes no difference if we try out to exclude analyzer dependencies that way. Maybe we didn't get it correctly? Is this the intended approach?

If this doesn't work, we have these ideas:

  1. Create a script that comments out the analyzer dependencies in the paket.references files and then executes paket install to remove them before we trigger a build and pack workflow. It's a bad practice because the created & published packages might not have the same transient dependencies as during the development.
  2. Create an additional packaging group and duplicate the main group without the analyzers into it and use it for the build and packaging process. This is annoying because of the duplication. Again the same bad practice.
  3. Move to paket pack with template files where we can exactly specify the dependencies. But this is somehow "not wished" because of the risk to forget something.

What's your recommendation to proceed?

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.

Research direction

Start by reproducing the package creation flow with Paket-managed Roslyn analyzers using dotnet pack, then inspect the generated NuGet metadata. Compare the behavior of copy_local in paket.references with the proposed packaging group and paket pack template approaches; done means analyzer dependencies are excluded from published packages without removing them from development dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.