3

We noticed an issue when a new team member did a local setup of my project. The Sitecore Nuget packages did not get resolved correctly. After a while I noticed that the packages on the new install were in folders like packages\Sitecore.Kernel.NoReferences.9.0.180604\lib\NET462. The last part (net462) was the tricky one, as I noticed on my machine they were in a net452 folder. Problem is that those folders are stored in the project files.

I tried:

  • physically all package files and restore them with VS
  • removing the packages from my solution and re-installing them
  • rebooting :) (combined with previous steps)

Nothing seems to work.. the packages keep getting installed in a net452 folder on my machine, although it is definitely a 4.6.2 version.

When we tried this on a third dev machine, it was even more strange. Some packages got into 452 folders, others in 462.. :(

Any idea why this is happening and how I can get VS to install the packages in a 462 folder?

2 Answers 2

6

After trying almost everything and searching half the internet, I found the solution here: https://docs.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders

And especially the magic button in Visual Studio on this screen: enter image description here

Once I cleared my Nuget caches -and removed all my package files once again- the restored packages got installed in a 462 folder as they should.

Apparently Nuget keeps caches locally. And as my laptop is getting old and already has been used for several Sitecore projects (including older versions on older .net frameworks) I probably had some caching issue. Still weird that this happened for packages from Sitecore 9 (which don't even have 4.5.x versions).

As this took me some time to figure out, I hope this might help someone else facing the same issue.

1
  • Thanks a lot! You made my day :) I tried everything without any results. But your solution definitely works! Commented Sep 3, 2018 at 16:04
3

It happened to me once and I fixed it by clearing nuget cache as Gatogordo But for some reason it doesn't work anymore even when I clear cache manually. I got tired of it and wrote a script. It targets libs I had issue with Sitecore*9.0.180604 run it from packages folder and it will rename 452 to 462. It is safe to do as I noticed those libraries target 462 anyway.

Get-ChildItem | Foreach-Object{ 
if($_.Name.StartsWith('Sitecore') -and $_.Name.EndsWith('9.0.180604')){
write-host 'Sitecore lib has been found'$_.Name
    Get-ChildItem -Path $_.FullName -Recurse | Where-Object {$_.Name -eq 'NET452'} | Foreach-Object { 
            Write-host 'Renaming '$_.FullName 
            Rename-Item -Path $_.FullName -NewName 'NET462'
        }
}
}

Not pretty and not recommended but do the job

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.