fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 525 forks source link

Broken restictions in paket.lock #3082

Closed draganjovanovic1 closed 6 years ago

draganjovanovic1 commented 6 years ago

Description

I do have both netcoreapp2.0 and netstandard2.0 projects in the solution and this framework restriction in paket.dependencies file

framework: netcoreapp20, netstandard20

Everything used to work correctly for a long time but recently Paket started adding restrictions to paket.lock where condition can't be satisfied:

    Microsoft.AspNetCore (2.0.1) - restriction: || (== netcoreapp2.0) (&& (== netstandard2.0) (>= netcoreapp2.0))

This does not work for netstandard2.0 project because of the "(&& (== netstandard2.0) (>= netcoreapp2.0))" restriction.

Repro steps

  1. Make solution with netstandard2.0 and netcoreapp2.0 projects.
  2. Add paket.dependencies with framework restriction:
    
    source https://api.nuget.org/v3/index.json
    framework: netcoreapp20, netstandard20

nuget Microsoft.AspNetCore.All ...

3. Add Microsoft.AspNetCore.Http NuGet to netstandard2.0 project.
4. Write some code in netstandard2.0 project which uses Microsoft.AspNetCore namespace. E.g.:

open Microsoft.AspNetCore.Http open Microsoft.AspNetCore.Http.Extensions open Microsoft.AspNetCore.Http.Internal open Microsoft.AspNetCore.Http.Features


4. Execute paket install
5. dotnet build (with restore)

### Expected behavior

Build is successful.

### Actual behavior

Build failed with:
error FS0039: The namespace 'AspNetCore' is not defined.

### Known workarounds

Remove restrictions (VS Code regex find: "- restriction:.*$" and replace with "") and execute dotnet restore again.
forki commented 6 years ago

can you please upload a zip with that repro project?

draganjovanovic1 commented 6 years ago

Here it is w/o paket.lock included: paket-restrictions-repro.zip

Repro steps

  1. sh paket.sh install OR paket install
  2. dotnet build

Workaround

  1. Fix paket.lock - VS Code regex find: "- restriction:.*$" and replace with ""
  2. dotnet build
forki commented 6 years ago

did a paket install and dotnet build:

image

everything green!?

forki commented 6 years ago
RESTRICTION: || (== netcoreapp2.0) (== netstandard2.0)
NUGET
  remote: https://api.nuget.org/v3/index.json
    FAKE (4.64.6)

   ....

    Microsoft.AspNetCore (2.0.1)
      Microsoft.AspNetCore.Diagnostics (>= 2.0.1)
      Microsoft.AspNetCore.Hosting (>= 2.0.1)
      Microsoft.AspNetCore.Routing (>= 2.0.1)
      Microsoft.AspNetCore.Server.IISIntegration (>= 2.0.1)
      Microsoft.AspNetCore.Server.Kestrel (>= 2.0.1)
      Microsoft.AspNetCore.Server.Kestrel.Https (>= 2.0.1)
      Microsoft.Extensions.Configuration.CommandLine (>= 2.0)
      Microsoft.Extensions.Configuration.EnvironmentVariables (>= 2.0)
      Microsoft.Extensions.Configuration.FileExtensions (>= 2.0)
      Microsoft.Extensions.Configuration.Json (>= 2.0)
      Microsoft.Extensions.Configuration.UserSecrets (>= 2.0)
      Microsoft.Extensions.Logging (>= 2.0)
      Microsoft.Extensions.Logging.Configuration (>= 2.0)
      Microsoft.Extensions.Logging.Console (>= 2.0)
      Microsoft.Extensions.Logging.Debug (>= 2.0)
...

paket.lock files looks good for me.

draganjovanovic1 commented 6 years ago

I accidentally zipped paket.lock as well. Please delete it and try again.

Here is my output:

Dragans-MBP:paket-restrictions-repro dragan$ sh paket.sh install && dotnet build
Paket version 5.145.2
Resolving packages for group Main:
 - FAKE 4.64.6
 - FSharp.Core 4.3.4
 - Microsoft.AspNetCore.All 2.0.5
 - Giraffe 1.1.0
 - Serilog 2.6.0
 - Newtonsoft.Json 11.0.1
 - System.Text.RegularExpressions 4.3.0
 - System.Xml.XmlSerializer 4.3.0
 - System.Dynamic.Runtime 4.3.0
 - Microsoft.CSharp 4.4.1
 - System.Collections.NonGeneric 4.3.0
 - Microsoft.AspNetCore.Mvc 2.0.2
 - Microsoft.AspNetCore.Mvc.Abstractions 2.0.2
 - Microsoft.AspNetCore.Mvc.ApiExplorer 2.0.2
 - Microsoft.AspNetCore.Mvc.Core 2.0.2
 - Microsoft.AspNetCore.Mvc.Cors 2.0.2
 - Microsoft.AspNetCore.Mvc.DataAnnotations 2.0.2
 - Microsoft.AspNetCore.Mvc.Formatters.Json 2.0.2
 - Microsoft.AspNetCore.Mvc.Formatters.Xml 2.0.2
 - Microsoft.AspNetCore.Mvc.Localization 2.0.2
 - Microsoft.AspNetCore.Mvc.Razor 2.0.2
 - Microsoft.AspNetCore.Mvc.Razor.ViewCompilation 2.0.2
 - Microsoft.AspNetCore.Mvc.RazorPages 2.0.2
 - Microsoft.AspNetCore.Mvc.TagHelpers 2.0.2
 - Microsoft.AspNetCore.Mvc.ViewFeatures 2.0.2
 - Microsoft.AspNetCore.NodeServices 2.0.2
 - Microsoft.AspNetCore.SpaServices 2.0.2
 - Microsoft.AspNetCore.Authentication 2.0.1
 - Microsoft.AspNetCore.Diagnostics 2.0.1
 - Microsoft.AspNetCore.Hosting.Abstractions 2.0.1
 - Microsoft.AspNetCore 2.0.1
 - Microsoft.AspNetCore.Antiforgery 2.0.1
 - Microsoft.AspNetCore.ApplicationInsights.HostingStartup 2.0.1
 - Microsoft.AspNetCore.Authentication.Abstractions 2.0.1
 - Microsoft.AspNetCore.Authentication.Cookies 2.0.1
 - Microsoft.AspNetCore.Authentication.Core 2.0.1
 - Microsoft.AspNetCore.Authentication.Facebook 2.0.1
 - Microsoft.AspNetCore.Authentication.Google 2.0.1
 - Microsoft.AspNetCore.Authentication.JwtBearer 2.0.1
 - Microsoft.AspNetCore.Authentication.MicrosoftAccount 2.0.1
 - Microsoft.AspNetCore.Authentication.OAuth 2.0.1
 - Microsoft.AspNetCore.Authentication.OpenIdConnect 2.0.1
 - Microsoft.AspNetCore.Authentication.Twitter 2.0.1
 - Microsoft.AspNetCore.Authorization 2.0.1
 - Microsoft.AspNetCore.Authorization.Policy 2.0.1
 - Microsoft.AspNetCore.AzureAppServices.HostingStartup 2.0.1
 - Microsoft.AspNetCore.AzureAppServicesIntegration 2.0.1
 - Microsoft.AspNetCore.CookiePolicy 2.0.1
 - Microsoft.AspNetCore.Cors 2.0.1
 - Microsoft.AspNetCore.Cryptography.Internal 2.0.1
 - Microsoft.AspNetCore.Cryptography.KeyDerivation 2.0.1
 - Microsoft.AspNetCore.DataProtection 2.0.1
 - Microsoft.AspNetCore.DataProtection.Abstractions 2.0.1
 - Microsoft.AspNetCore.DataProtection.AzureStorage 2.0.1
 - Microsoft.AspNetCore.DataProtection.Extensions 2.0.1
 - Microsoft.AspNetCore.Diagnostics.Abstractions 2.0.1
 - Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 2.0.1
 - Microsoft.AspNetCore.Hosting 2.0.1
 - Microsoft.AspNetCore.Hosting.Server.Abstractions 2.0.1
 - Microsoft.AspNetCore.Http 2.0.1
 - Microsoft.AspNetCore.Http.Abstractions 2.0.1
 - Microsoft.AspNetCore.Http.Extensions 2.0.1
 - Microsoft.AspNetCore.Http.Features 2.0.1
 - Microsoft.AspNetCore.HttpOverrides 2.0.1
 - Microsoft.AspNetCore.Identity 2.0.1
 - Microsoft.AspNetCore.Identity.EntityFrameworkCore 2.0.1
 - Microsoft.AspNetCore.Localization 2.0.1
 - Microsoft.AspNetCore.Localization.Routing 2.0.1
 - Microsoft.AspNetCore.MiddlewareAnalysis 2.0.1
 - Microsoft.AspNetCore.Mvc.Razor.Extensions 2.0.1
 - Microsoft.AspNetCore.Owin 2.0.1
 - Microsoft.AspNetCore.Razor 2.0.1
 - Microsoft.AspNetCore.Razor.Language 2.0.1
 - Microsoft.AspNetCore.Razor.Runtime 2.0.1
 - Microsoft.AspNetCore.ResponseCaching 2.0.1
 - Microsoft.AspNetCore.ResponseCaching.Abstractions 2.0.1
 - Microsoft.AspNetCore.ResponseCompression 2.0.1
 - Microsoft.AspNetCore.Rewrite 2.0.1
 - Microsoft.AspNetCore.Routing 2.0.1
 - Microsoft.AspNetCore.Routing.Abstractions 2.0.1
 - Microsoft.AspNetCore.Server.HttpSys 2.0.2
 - Microsoft.AspNetCore.Server.IISIntegration 2.0.1
 - Microsoft.AspNetCore.Server.Kestrel 2.0.1
 - Microsoft.AspNetCore.Server.Kestrel.Core 2.0.1
 - Microsoft.AspNetCore.Server.Kestrel.Https 2.0.1
 - Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions 2.0.1
 - Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv 2.0.1
 - Microsoft.AspNetCore.Session 2.0.1
 - Microsoft.AspNetCore.StaticFiles 2.0.1
 - Microsoft.AspNetCore.WebSockets 2.0.1
 - Microsoft.AspNetCore.WebUtilities 2.0.1
 - Microsoft.CodeAnalysis.Razor 2.0.1
 - Microsoft.EntityFrameworkCore 2.0.1
 - Microsoft.EntityFrameworkCore.Design 2.0.1
 - Microsoft.EntityFrameworkCore.InMemory 2.0.1
 - Microsoft.EntityFrameworkCore.Relational 2.0.1
 - Microsoft.EntityFrameworkCore.Sqlite 2.0.1
 - Microsoft.EntityFrameworkCore.Sqlite.Core 2.0.1
 - Microsoft.EntityFrameworkCore.SqlServer 2.0.1
 - Microsoft.EntityFrameworkCore.Tools 2.0.1
 - Microsoft.Extensions.Hosting.Abstractions 2.0.1
 - Microsoft.Extensions.Identity.Core 2.0.1
 - Microsoft.Extensions.Identity.Stores 2.0.1
 - Microsoft.Extensions.Localization 2.0.1
 - Microsoft.Extensions.Localization.Abstractions 2.0.1
 - Microsoft.Net.Http.Headers 2.0.1
 - Microsoft.VisualStudio.Web.BrowserLink 2.0.1
 - Microsoft.AspNetCore.Html.Abstractions 2.0.0
 - Microsoft.AspNetCore.JsonPatch 2.0.0
 - Microsoft.Data.Sqlite 2.0.0
 - Microsoft.Data.Sqlite.Core 2.0.0
 - Microsoft.Extensions.Caching.Abstractions 2.0.0
 - Microsoft.Extensions.Caching.Memory 2.0.0
 - Microsoft.Extensions.Caching.Redis 2.0.0
 - Microsoft.Extensions.Caching.SqlServer 2.0.0
 - Microsoft.Extensions.Configuration 2.0.0
 - Microsoft.Extensions.Configuration.Abstractions 2.0.0
 - Microsoft.Extensions.Configuration.AzureKeyVault 2.0.0
 - Microsoft.Extensions.Configuration.Binder 2.0.0
 - Microsoft.Extensions.Configuration.CommandLine 2.0.0
 - Microsoft.Extensions.Configuration.EnvironmentVariables 2.0.0
 - Microsoft.Extensions.Configuration.FileExtensions 2.0.0
 - Microsoft.Extensions.Configuration.Ini 2.0.0
 - Microsoft.Extensions.Configuration.Json 2.0.0
 - Microsoft.Extensions.Configuration.UserSecrets 2.0.0
 - Microsoft.Extensions.Configuration.Xml 2.0.0
 - Microsoft.Extensions.DependencyInjection 2.0.0
 - Microsoft.Extensions.DependencyInjection.Abstractions 2.0.0
 - Microsoft.Extensions.DiagnosticAdapter 2.0.0
 - Microsoft.Extensions.FileProviders.Abstractions 2.0.0
 - Microsoft.Extensions.FileProviders.Composite 2.0.0
 - Microsoft.Extensions.FileProviders.Embedded 2.0.0
 - Microsoft.Extensions.FileProviders.Physical 2.0.0
 - Microsoft.Extensions.FileSystemGlobbing 2.0.0
 - Microsoft.Extensions.Logging 2.0.0
 - Microsoft.Extensions.Logging.Abstractions 2.0.0
 - Microsoft.Extensions.Logging.AzureAppServices 2.0.0
 - Microsoft.Extensions.Logging.Configuration 2.0.0
 - Microsoft.Extensions.Logging.Console 2.0.0
 - Microsoft.Extensions.Logging.Debug 2.0.0
 - Microsoft.Extensions.Logging.EventSource 2.0.0
 - Microsoft.Extensions.Logging.TraceSource 2.0.0
 - Microsoft.Extensions.ObjectPool 2.0.0
 - Microsoft.Extensions.Options 2.0.0
 - Microsoft.Extensions.Options.ConfigurationExtensions 2.0.0
 - Microsoft.Extensions.Primitives 2.0.0
 - Microsoft.Extensions.WebEncoders 2.0.0
 - TaskBuilder.fs 1.1.1
 - WindowsAzure.Storage 9.0.0
 - System.Diagnostics.DiagnosticSource 4.4.1
 - Microsoft.Win32.Registry 4.4.0
 - System.Security.Cryptography.Xml 4.4.1
 - System.Text.Encodings.Web 4.4.0
 - System.Buffers 4.4.0
 - System.ComponentModel.Annotations 4.4.1
 - System.Security.Principal.Windows 4.4.1
 - System.Threading.Tasks.Extensions 4.4.0
 - System.Numerics.Vectors 4.4.0
 - System.Data.SqlClient 4.4.2
 - System.ValueTuple 4.4.0
 - System.Runtime.CompilerServices.Unsafe 4.4.0
 - System.Diagnostics.Debug 4.3.0
 - System.Linq.Expressions 4.3.0
 - System.ObjectModel 4.3.0
 - System.Collections 4.3.0
 - System.Globalization 4.3.0
 - System.Resources.ResourceManager 4.3.0
 - System.Runtime 4.3.0
 - System.Runtime.Extensions 4.3.0
 - System.Threading 4.3.0
 - System.IO 4.3.0
 - System.Linq 4.3.0
 - System.Reflection 4.3.0
 - System.Reflection.Emit 4.3.0
 - System.Reflection.Emit.ILGeneration 4.3.0
 - System.Reflection.Extensions 4.3.0
 - System.Reflection.Primitives 4.3.0
 - System.Reflection.TypeExtensions 4.4.0
 - System.Xml.ReaderWriter 4.3.1
 - System.Xml.XmlDocument 4.3.0
 - Microsoft.IdentityModel.Clients.ActiveDirectory 3.19.1
 - System.Interactive.Async 3.1.1
 - Microsoft.Azure.KeyVault 2.3.2
 - Microsoft.CodeAnalysis.CSharp 2.6.1
 - Microsoft.IdentityModel.Protocols.OpenIdConnect 5.2.1
 - Microsoft.ApplicationInsights.AspNetCore 2.2.1
 - Remotion.Linq 2.2.0
 - Microsoft.Extensions.DependencyModel 2.0.4
 - Libuv 1.10.0
 - NETStandard.Library 2.0.1
 - System.Reflection.Metadata 1.5.0
 - System.Collections.Immutable 1.4.0
 - StackExchange.Redis.StrongName 1.2.6
 - SQLitePCLRaw.core 1.1.9
 - SQLitePCLRaw.bundle_green 1.1.9
 - Newtonsoft.Json.Bson 1.0.1
 - Microsoft.CodeAnalysis.Common 2.6.1
 - Microsoft.Rest.ClientRuntime.Azure 3.3.11
 - Microsoft.IdentityModel.Protocols 5.2.1
 - System.IdentityModel.Tokens.Jwt 5.2.1
 - System.Security.AccessControl 4.4.1
 - runtime.native.System.Data.SqlClient.sni 4.4.0
 - System.Text.Encoding.CodePages 4.4.0
 - System.Net.NameResolution 4.3.0
 - System.Net.Http 4.3.3
 - System.Runtime.Serialization.Json 4.3.0
 - System.Runtime.Serialization.Primitives 4.3.0
 - System.Collections.Concurrent 4.3.0
 - System.Diagnostics.Tools 4.3.0
 - System.IO.Compression 4.3.0
 - System.IO.FileSystem 4.3.0
 - System.Net.Security 4.3.2
 - System.Net.Sockets 4.3.0
 - System.Reflection.Emit.Lightweight 4.3.0
 - System.Runtime.InteropServices.RuntimeInformation 4.3.0
 - System.Security.Cryptography.Algorithms 4.3.1
 - System.Security.Cryptography.X509Certificates 4.3.2
 - System.Threading.Thread 4.3.0
 - System.Threading.ThreadPool 4.3.0
 - System.Threading.Timer 4.3.0
 - System.Diagnostics.Tracing 4.3.0
 - System.Text.Encoding 4.3.0
 - System.Threading.Tasks 4.3.0
 - System.IO.FileSystem.Primitives 4.3.0
 - System.Runtime.InteropServices 4.3.0
 - System.Text.Encoding.Extensions 4.3.0
 - System.Linq.Queryable 4.3.0
 - Microsoft.ApplicationInsights 2.5.1
 - Microsoft.ApplicationInsights.DependencyCollector 2.5.1
 - Microsoft.ApplicationInsights.PerfCounterCollector 2.5.1
 - Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 2.5.1
 - Microsoft.Azure.KeyVault.WebKey 2.0.7
 - Microsoft.DotNet.PlatformAbstractions 2.0.4
 - Microsoft.NETCore.Platforms 2.0.1
 - SQLitePCLRaw.lib.e_sqlite3.linux 1.1.9
 - SQLitePCLRaw.lib.e_sqlite3.osx 1.1.9
 - SQLitePCLRaw.lib.e_sqlite3.v110_xp 1.1.9
 - SQLitePCLRaw.provider.e_sqlite3.netstandard11 1.1.9
 - Microsoft.NETCore.Targets 2.0.0
 - Microsoft.Rest.ClientRuntime 2.3.10
 - Microsoft.IdentityModel.Logging 5.2.1
 - Microsoft.IdentityModel.Tokens 5.2.1
 - runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0
 - runtime.win-x64.runtime.native.System.Data.SqlClient.sni 4.4.0
 - runtime.win-x86.runtime.native.System.Data.SqlClient.sni 4.4.0
 - runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.native.System.Security.Cryptography.Apple 4.3.1
 - System.Net.Requests 4.3.0
 - System.Diagnostics.Process 4.3.0
 - System.IO.FileSystem.AccessControl 4.4.0
 - System.Net.NetworkInformation 4.3.0
 - System.Net.WebHeaderCollection 4.3.0
 - System.AppContext 4.3.0
 - System.Console 4.3.0
 - System.Diagnostics.FileVersionInfo 4.3.0
 - System.Diagnostics.StackTrace 4.3.0
 - System.Runtime.Numerics 4.3.0
 - System.Security.Cryptography.Encoding 4.3.0
 - System.Threading.Tasks.Parallel 4.3.0
 - System.Xml.XDocument 4.3.0
 - System.Xml.XPath.XDocument 4.3.0
 - System.Collections.Specialized 4.3.0
 - System.Diagnostics.Contracts 4.3.0
 - runtime.native.System.IO.Compression 4.3.1
 - runtime.native.System.Net.Http 4.3.0
 - System.Globalization.Extensions 4.3.0
 - System.Security.Cryptography.OpenSsl 4.4.0
 - System.Security.Cryptography.Primitives 4.3.0
 - runtime.native.System 4.3.0
 - System.Net.Primitives 4.3.0
 - System.Runtime.Handles 4.3.0
 - Microsoft.Win32.Primitives 4.3.0
 - runtime.native.System.Net.Security 4.3.0
 - System.Security.Claims 4.3.0
 - System.Security.Principal 4.3.0
 - System.Private.DataContractSerialization 4.3.0
 - System.Globalization.Calendars 4.3.0
 - System.Security.Cryptography.Cng 4.4.0
 - System.Security.Cryptography.Csp 4.3.0
 - Microsoft.Extensions.PlatformAbstractions 1.1.0
 - Microsoft.CodeAnalysis.Analyzers 2.6.0
 - runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.2
 - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple 4.3.1
 - System.Runtime.Serialization.Xml 4.3.0
 - System.Threading.Overlapped 4.3.0
 - System.Xml.XPath 4.3.0
Locked version resolution written to /Users/dragan/Projects/paket-restrictions-repro/paket.lock
Installing into projects:
 - Creating model and downloading packages.
 - webapp/paket.references -> webapp/webapp.fsproj
 - weblib/paket.references -> weblib/weblib.fsproj
Performance:
 - Resolver: 26 seconds (1 runs)
    - Runtime: 3 seconds
    - Blocked (retrieving package details): 12 seconds (205 times)
    - Blocked (retrieving package versions): 10 seconds (19 times)
    - Not Blocked (retrieving package details): 90 times
    - Not Blocked (retrieving package versions): 276 times
 - Disk IO: 284 milliseconds
 - Average Request Time: 85 milliseconds
 - Number of Requests: 299
 - Runtime: 34 seconds
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(4,16): error FS0039: The namespace 'Extensions' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(5,16): error FS0039: The namespace 'AspNetCore' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(8,37): error FS0039: The type 'RequestDelegate' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(12,32): error FS0039: The type 'HttpContext' is not defined. Maybe you want one of the following:   AppContext [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(12,32): error FS0039: The type 'HttpContext' is not defined. Maybe you want one of the following:   AppContext [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(13,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(15,26): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(15,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(18,9): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(19,9): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(21,60): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(22,9): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(25,20): error FS0039: The namespace 'AspNetCore' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(27,20): error FS0039: The type 'AspNetCore' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]

Build FAILED.

/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(4,16): error FS0039: The namespace 'Extensions' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(5,16): error FS0039: The namespace 'AspNetCore' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(8,37): error FS0039: The type 'RequestDelegate' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(12,32): error FS0039: The type 'HttpContext' is not defined. Maybe you want one of the following:   AppContext [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(12,32): error FS0039: The type 'HttpContext' is not defined. Maybe you want one of the following:   AppContext [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(13,29): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(15,26): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(15,47): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(18,9): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(19,9): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(21,60): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(22,9): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(25,20): error FS0039: The namespace 'AspNetCore' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
/Users/dragan/Projects/paket-restrictions-repro/weblib/CorrelationIdMiddleware.fs(27,20): error FS0039: The type 'AspNetCore' is not defined. [/Users/dragan/Projects/paket-restrictions-repro/weblib/weblib.fsproj]
    0 Warning(s)
    14 Error(s)
draganjovanovic1 commented 6 years ago

And here is my output after I remove -restriction: lines from paket.lock

Dragans-MBP:paket-restrictions-repro dragan$ dotnet build
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  weblib -> /Users/dragan/Projects/paket-restrictions-repro/weblib/bin/Debug/netstandard2.0/weblib.dll
  webapp -> /Users/dragan/Projects/paket-restrictions-repro/webapp/bin/Debug/netcoreapp2.0/webapp.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)
forki commented 6 years ago

I'm a bit lost. I think it's a bug, but I need @matthid to investigate it

matthid commented 6 years ago

Ok this indeed took a while to understand, but it seems like everything works as designed. Let me explain that a bit...

Some facts (at least that's what my testing yields):

Therefore either:

The workaround is to manually add all packages you need for your netstandard application to your dependencies file:

paket.dependencies

version 5.145.2
source https://api.nuget.org/v3/index.json

framework: netstandard20, netcoreapp20

nuget FAKE
nuget FSharp.Core
nuget Microsoft.AspNetCore.All
nuget Giraffe
nuget Serilog
nuget Microsoft.AspNetCore.Http
nuget Microsoft.Extensions.Primitives

This is working for me with and without global restrictions.

So what we can improve is:

$ ../Paket/bin/paket.exe restriction "|| (== netcoreapp2.0) (&& (== netstandard2.0) (>= netcoreapp2.0))"
Paket version 5.145.1
Restriction: || (== netcoreapp2.0) (&& (== netstandard2.0) (>= netcoreapp2.0))
Simplified: || (== netcoreapp2.0) (&& (== netstandard2.0) (>= netcoreapp2.0))
Frameworks: [
   netcoreapp2.0
]
Performance:
 - Runtime: 763 milliseconds
draganjovanovic1 commented 6 years ago

@matthid, I can confirm that adding Microsoft.AspNetCore.Http in addition to Microsoft.AspNetCore.All metapackage helps.

You are right, Microsoft.AspNetCore.All metapackage is netcoreapp2.0 only even lots of packages included are netstandard2.0. This used to work for a long time and suddenly stopped so I thought it is paket issue but it is obviously not.