Paket dependencies not added to build
Opened this issue · 6 comments
Description
Dependencies specified in paket.dependencies
are not made available at build time
Repro steps
dotnet paket init
- Add
dependencies
topaket.dependencies
,paket.references
dotnet paket install
dotnet paket restore
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
This behavior is expected, because package doesn't support .NETCoreApp 3.1.
You might consider downgrading to 3.0.
I'm pretty sure the dependencies I'm using require 3.1, but I can double check.
In any case, 3.1 is the current LTS version of .Net Core. Is there any plans to support it in the near future?
(Also did the documentation mention this? The documentation I read just said 3.0+)
Paket works perfectly fine with 3.1. The target package(s) doesn't support 3.1. And you explicitly exclude 3.0 here.
Upd: just to clarify. Try netcoreapp30
moniker.
Oh, my apologies. I misread "pakage" as "paket". I will fix this and re-try.
Edit: It occurs to me that maybe this should have been caught with a more descriptive error message. NuGet certainly provides feedback about incompatible target frameworks, for example.
I'm having similar issues. I would expect paket.dependencies
to contain framework: netcoreapp3.1
when I init
in a .net core 3.1 solution. Instead it contains netcore3.0
. I change that to netcoreapp3.1
and all is well.
source https://api.nuget.org/v3/index.json
storage: none
framework: netcoreapp3.1, netstandard2.0, netstandard2.1
Anything updated? I also got an issue when I use target framework net5.0 and paket version 5.258.1.
The type or namespace name 'HtmlAgilityPack' could not be found (are you missing a using directive or an assembly reference?)
I used dotnet build
got the error but when I retry with build action from Visual Studio, the error doesn't happened?
But I need dotnet build
for CI so please help me to resolve it