Last post Jun 28, 2018 03:19 AM by noJedi
Jun 26, 2018 03:27 AM|noJedi|LINK
This is driving me crazy...
I have a VS workstation that does NOT have access to NUGET (ie no internet)
it has dotnetcore 1/1.1/2/2.1 SDKs and runtimes installed, I create a new .netcore web application with NOAUTH and it will not build...
It complains with Cycle Detected:
Microsoft.AspNetCore.All 2.0.3 -> Microsoft.AspNetCore.Authentication.JwtBearer 2.0.1 -> Microsoft.IdentityModel.Protocols.OpenIdConnect 2.1.4 -> Microsoft.IdentityModel.Protocols 2.1.4 ->
System.IdentityModel.Tokens.Jwt 5.1.4 -> Microsoft.IdentityModel.Tokens 5.1.4 -> Microsoft.IdentityModel.Protocols 2.1.4 ->
System.IdentityModel.Tokens.Jwt (>= 5.1.4).
I assume the issue is that there appears to be a cyclical reference where
OpenIdConnect wants "Protocols", protocols wants Tokens.Jwt whcih wants Tokens which wants PRotocols which wants Jwt... and so on...
I tried this SAME process on a machine that is connect to the internet and it builds fine... <insert much swearing...>
So how do you resolve this?
Jun 26, 2018 11:34 AM|mgebhard|LINK
Visual Studio assumes and internet connection. If you want offline dev then I think you need to configure Visual Studio to look for packages locally.
Jun 26, 2018 03:27 PM|noJedi|LINK
Yeah, so not really convinced this is the issue, have done the requisite "offlining" of restore and packages APPEAR to be identical...
(additionally running builds from CLI follow same issues in compilation, and the "internet connected" PC successfully builds when isolated from internet...)
However in reviewing what you said I have noticed the following two anomalies...
1) VS on the offline machine (possibly?) has different templates installed (somehow has different SDKs - perhaps updates from being online when SDKs/runtimes installed?) - most subtle but I did just realise, some of the templates add the "Microsoft.aspnetcore.APP"
nuget package (targets? bundle?) not the "Microsoft.aspnetcore.ALL" one... not sure if there is a difference or if it is somewhat immaterial, but it took me a while to SEE that these are actually different (ALL / APP + my dyslexia, not a good combo...)
2) While building does indeed give the issues I outlined, in VS it shows something different, on the "offline machine" it shows Exclamation icon next to the Microsoft.AspNetCore.DataProtection.AzureStorage "bundle" (do these have a name - I assume they are
all pacakges in their own right, but just "included" for brevity as a platform bundle of somekind) - on the "online machine" this does not show as "Warning" icon, and contains no reference to teh "Microsoft.Azure.KeyVault" that the offline machine is complaining
is a dependency of System.Spatial 5.8.2 - These are just WARNINGS however...
Okay... perhaps it pays to give some attention to WARNINGS... I still don't quite know what's going on exactly, but I discovered these differences as well... this must be the issue, but I'm not sure how best to resolve...
Offline machine (build Fails) - has these:
dotnet --info -> reports sdk up to 2.1.300
Online machine (build Succeeds) - has this ONLY
dotnet --info -> reports sdk up to 2.1.301 - everything else is identical to offline machine...
no sight of other .nuget entries...
Jun 26, 2018 06:03 PM|noJedi|LINK
POSSIBLY all of the warnings and errors above are red-herrings because of the build process/order/other...
However here is my solution in two parts (as in this solved the issue for me):
#1 dotnetcore "All" package seems to have SOME issue with Token.JWT 5.1.4 that is part of the "metapackage" .ALL for core2.0 - (but again could all be some kind of redherring) ?a guess? -> solution is to install manually Token.Jwt 5.2.2... for some reason
I could not get this to "take" (using tooling) however having all the packages installed (in nugetfallbackfolder), all I really needed to do was modify the .csproj file to point to this explicitly, even though it is part of the "All" metapackage...
eg; in .PROJ file ==> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.2.2" />
#2 - updating to core2.1 - MAY work better/only with the .APP metapackage - (When converting an ASP.NET Core 2.0 project to ASP.NET Core 2.1 and transitioning to the Microsoft.AspNetCore.App metapackage
https://docs.microsoft.com/en-us/aspnet/core/migration/20_21?view=aspnetcore-2.1 ), I'm still figuring this out, but in my distress of trying ANYTHING to get this working, I tried updating to core 2.1 and this gave its own issues...
I STill have NO idea why this works on one machine and not another, when - as far as we can tell, the only difference is INTERNET access and the packages are all brought in manually... but all the same as far as we can tell...
Jun 27, 2018 06:09 AM|Edward Z|LINK
>> However here is my solution in two parts (as in this solved the issue for me)
Do you mean you resolved your issue?
I made a test with creating new project without Internet, but I fail to reproduce your issue.
I would suggest you make test by copying the project from no-internet or internet computer, will it work?
If you turn off network connection, will this reproducible on this working computer?
Jun 28, 2018 03:09 AM|noJedi|LINK
Yep, sorry if this wasn't clear.
Resolved for core 2.1 - maybe there is a problem with the SDK/runtime on my box for dotnetcore 2.0 will try reinstalling...
Anyway the solution I provided works on the "offline" machine.
The offline machine essentially has got the packages copied from the online machine... but this is still the issue.
Yes tried disconnecting the "online" machine and re-trying, and it doesn't appear to have the problem when offline.
As mentioned in the UPDATE: the offline machine in .net Core 2.0 complains with the following message, which to my addled brain sounds like some kind of build/config issue between "<user>\.nuget\packages" and "dotnet\sdk\nugetfallbackfolder" as the 5.1.8
package is in the fallbackfolder but not in the ".nuget\packages" folder...
warning NU1603: Microsoft.IdentityModel.Tokens 5.1.4 depends on Microsoft.IdentityModel.Protocols (>= 1.1.4) but Microsoft.IdentityModel.Protocols 1.1.4 was not found. An approximate best match of
Microsoft.IdentityModel.Protocols 2.1.4 was resolved.
warning NU1603: Microsoft.Azure.KeyVault 2.3.2 depends on System.Spatial (>= 2.3.8 && < 3.0.0) but System.Spatial 2.3.8 was not found. An approximate best match of
System.Spatial 5.7.0 was resolved.
error NU1108: Cycle detected.
error NU1108: WebApplication1 -> Microsoft.AspNetCore.All 2.0.3 -> Microsoft.AspNetCore.Authentication.JwtBearer 2.0.1 -> Microsoft.IdentityModel.Protocols.OpenIdConnect 2.1.4 -> Microsoft.IdentityModel.Protocols 2.1.4 -> System.IdentityModel.Tokens.Jwt 5.1.4
-> Microsoft.IdentityModel.Tokens 5.1.4 -> Microsoft.IdentityModel.Protocols 2.1.4 -> System.IdentityModel.Tokens.Jwt (>= 5.1.4).
As mentioned before the <user>\.nuget\packages folder is the only one on the system that has "System.Spatial 5.7.0" the dotnet\sdk\nugetfallbackfolder\ has ONLY System.Spatial 5.8.2... this leads me to belive that "something is not quite right" with this
system/install of SDKs...??? perhaps...
Jun 28, 2018 03:19 AM|noJedi|LINK
Okay my last rant and in repsonse to both your feedback I went and had a look at the differences between online and offline systems folder structures in more detail...
The offline system had the following oddity.
and NOT this... which IS on the online machine...
Went back to the installers and reinstalled 2.0.3 SDK and this folder magically was created and build worked straight away!!!
Perhaps the dn2.0.3 sdk install was dodgy or this folder got killed or moved/removed somehow... all the other 2.0.3 items appear to be in place and not missing... weird, but thankfully I now know the reason!