fsprojects / fsprojects/Paket

Paket dependencies not added to build

Open
#3,802 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Dependencies specified in paket.dependencies are not made available at build time

Repro steps
  1. dotnet paket init
  2. Add dependencies to paket.dependencies, paket.references
  3. dotnet paket install
  4. dotnet paket restore
  5. dotnet build

Example git repository: https://github.com/Craige/paket-test

Expected behavior

Package dependencies should be added to the build. Build should succeed.

Actual behavior

Paket.restore.targets is added to .csproj, but package dependencies are seemingly not added to build. Any references to identifiers from the dependency generates a compilation error (e.g. The type or namespace name '%' could not be found)

➜  PaketTest git:(master) ✗ dotnet build Test/Test.csproj
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Paket version 5.242.2
  Starting restore process.
  Performance:
   - Runtime: 1 second
  Restore completed in 33.51 ms for /Users/craige/Source/PaketTest/Test/Test.csproj.
Manifest.cs(3,12): error CS0246: The type or namespace name 'ModuleAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(3,12): error CS0246: The type or namespace name 'Module' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(4,5): error CS0246: The type or namespace name 'Name' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(5,5): error CS0246: The type or namespace name 'Author' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(6,5): error CS0246: The type or namespace name 'Website' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(7,5): error CS0246: The type or namespace name 'Version' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(8,5): error CS0246: The type or namespace name 'Description' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(9,5): error CS0246: The type or namespace name 'Category' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(1,7): error CS0246: The type or namespace name 'OrchardCore' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Startup.cs(5,7): error CS0246: The type or namespace name 'OrchardCore' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Startup.cs(9,28): error CS0246: The type or namespace name 'StartupBase' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Startup.cs(11,30): error CS0115: 'Startup.ConfigureServices(IServiceCollection)': no suitable method found to override [/Users/craige/Source/PaketTest/Test/Test.csproj]
Startup.cs(15,30): error CS0115: 'Startup.Configure(IApplicationBuilder, IEndpointRouteBuilder, IServiceProvider)': no suitable method found to override [/Users/craige/Source/PaketTest/Test/Test.csproj]

Build FAILED.

Manifest.cs(3,12): error CS0246: The type or namespace name 'ModuleAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(3,12): error CS0246: The type or namespace name 'Module' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(4,5): error CS0246: The type or namespace name 'Name' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(5,5): error CS0246: The type or namespace name 'Author' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(6,5): error CS0246: The type or namespace name 'Website' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(7,5): error CS0246: The type or namespace name 'Version' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(8,5): error CS0246: The type or namespace name 'Description' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(9,5): error CS0246: The type or namespace name 'Category' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Manifest.cs(1,7): error CS0246: The type or namespace name 'OrchardCore' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Startup.cs(5,7): error CS0246: The type or namespace name 'OrchardCore' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Startup.cs(9,28): error CS0246: The type or namespace name 'StartupBase' could not be found (are you missing a using directive or an assembly reference?) [/Users/craige/Source/PaketTest/Test/Test.csproj]
Startup.cs(11,30): error CS0115: 'Startup.ConfigureServices(IServiceCollection)': no suitable method found to override [/Users/craige/Source/PaketTest/Test/Test.csproj]
Startup.cs(15,30): error CS0115: 'Startup.Configure(IApplicationBuilder, IEndpointRouteBuilder, IServiceProvider)': no suitable method found to override [/Users/craige/Source/PaketTest/Test/Test.csproj]
    0 Warning(s)
    13 Error(s)

Time Elapsed 00:00:03.37

Build succeeds with these dependencies as <PackageReference>s in .csproj:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Razor">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
  </PropertyGroup>
  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="OrchardCore.ContentManagement" Version="1.0.0-rc1-*" />
    <PackageReference Include="OrchardCore.ContentManagement.Abstractions" Version="1.0.0-rc1-*" />
    <PackageReference Include="OrchardCore.Module.Targets" Version="1.0.0-rc1-*" />
  </ItemGroup>
</Project>
➜  PaketTest git:(master) ✗ dotnet build Test/Test.csproj
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 34.15 ms for /Users/craige/Source/PaketTest/Test/Test.csproj.
  Test -> /Users/craige/Source/PaketTest/Test/bin/Debug/netcoreapp3.1/Test.dll
  Test -> /Users/craige/Source/PaketTest/Test/bin/Debug/netcoreapp3.1/Test.Views.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:02.39
Known workarounds

N/A

Environment

Paket 5.242.2
Dotnet Core 3.1
MacOS 10.14.6

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

Reproduce the failure with the listed dotnet paket and dotnet build commands in the linked PaketTest repository. Inspect the generated Test/Test.csproj and Paket.restore.targets, then compare the Paket-managed project with the working PackageReference version. Done means the package identifiers resolve and dotnet build succeeds without manually added PackageReference entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.