madskristensen / Packman

A client-side package manager
Other
28 stars 7 forks source link

Package restore doesn't work in Visual Studio 2017 Community #44

Open aqueenan opened 7 years ago

aqueenan commented 7 years ago

Installed product versions

Description

Package restore doesn't work in Visual Studio 2017 Community.

Steps to recreate

  1. If packman.json doesn't exist, add any client-side library and save the manifest.
  2. Right-click packman.json
  3. Click Restore Package
  4. Look in output window for Client-Side Package Installer

Current behavior

13/03/2017 6:06:24 PM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at PackmanVsix.PackageService.d5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine) at PackmanVsix.PackageService.IsValidJson(String file) at PackmanVsix.PackageService.d4.MoveNext() in C:\projects\packman\src\PackmanVsix\PackageService.cs:line 0

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Expected behavior

It should restore the files/packages listed in packman.json.

fooblinator commented 7 years ago

I am also getting the same error when trying to perform a package restore.

jc-stevens commented 7 years ago

I am also seeing this behavior.

Installed product versions Visual Studio: 2017 Enterprise 15.0.0+26228.9 This extension: Client Side Library Installer 1.2.130

Sc0tTyXL commented 7 years ago

Same issue here on VS 2017 Pro 15.2 (26430.13)

Tried manually adding Microsoft.JSON.Core to my project but its not available: https://www.nuget.org/packages?q=Microsoft.JSON.Core

hamzaahmedzia1 commented 7 years ago

I'm facing the exact same issue on Visual Studio 2017 Community 15.3.4 with client side library installer version 1.2.130.

I enabled logging and got the following output

9/16/2017 11:29:18 AM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at PackmanVsix.PackageService.<IsValidJson>d__5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine& stateMachine) at PackmanVsix.PackageService.IsValidJson(String file) at PackmanVsix.PackageService.d__4.MoveNext() in C:\projects\packman\src\PackmanVsix\PackageService.cs:line 0

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe --- A detailed error log follows.

=== Pre-bind state information === LOG: DisplayName = Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified) LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/ LOG: Initial PrivatePath = NULL Calling assembly : PackmanVsix, Version=1.2.130.0, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in LoadFrom load context. WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). LOG: Using application configuration file: C:\Users\ARHAZ\AppData\Local\Microsoft\VisualStudio\15.0_1f228c9d\devenv.exe.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/Microsoft.JSON.Core/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PublicAssemblies/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PublicAssemblies/Microsoft.JSON.Core/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/Microsoft.JSON.Core/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/Microsoft.JSON.Core/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Platform/Debugger/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Platform/Debugger/Microsoft.JSON.Core/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/Microsoft.JSON.Core/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/DataCollectors/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/DataCollectors/Microsoft.JSON.Core/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/DataCollectors/x86/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/DataCollectors/x86/Microsoft.JSON.Core/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/Microsoft.JSON.Core/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PublicAssemblies/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PublicAssemblies/Microsoft.JSON.Core/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/Microsoft.JSON.Core/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/Microsoft.JSON.Core/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Platform/Debugger/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Platform/Debugger/Microsoft.JSON.Core/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/Microsoft.JSON.Core/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/DataCollectors/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/DataCollectors/Microsoft.JSON.Core/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/DataCollectors/x86/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/PrivateAssemblies/DataCollectors/x86/Microsoft.JSON.Core/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Users/ARHAZ/AppData/Local/Microsoft/VisualStudio/15.0_1f228c9d/Extensions/xmceqjwt.olw/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Users/ARHAZ/AppData/Local/Microsoft/VisualStudio/15.0_1f228c9d/Extensions/xmceqjwt.olw/Microsoft.JSON.Core/Microsoft.JSON.Core.DLL. LOG: Attempting download of new URL file:///C:/Users/ARHAZ/AppData/Local/Microsoft/VisualStudio/15.0_1f228c9d/Extensions/xmceqjwt.olw/Microsoft.JSON.Core.EXE. LOG: Attempting download of new URL file:///C:/Users/ARHAZ/AppData/Local/Microsoft/VisualStudio/15.0_1f228c9d/Extensions/xmceqjwt.olw/Microsoft.JSON.Core/Microsoft.JSON.Core.EXE. `

Trying to restore a second time I got this log file

9/16/2017 11:31:16 AM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at PackmanVsix.PackageService.<IsValidJson>d__5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine& stateMachine) at PackmanVsix.PackageService.IsValidJson(String file) at PackmanVsix.PackageService.d__4.MoveNext() in C:\projects\packman\src\PackmanVsix\PackageService.cs:line 0

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe --- A detailed error log follows.

=== Pre-bind state information === LOG: DisplayName = Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified) LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/ LOG: Initial PrivatePath = NULL Calling assembly : PackmanVsix, Version=1.2.130.0, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in LoadFrom load context. WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load(). LOG: Using application configuration file: C:\Users\ARHAZ\AppData\Local\Microsoft\VisualStudio\15.0_1f228c9d\devenv.exe.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: Microsoft.JSON.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a LOG: The same bind was seen before, and was failed with hr = 0x80070002. `

hamzaahmedzia1 commented 7 years ago

Alright this is how I fixed it myself @madskristensen Can you verify if I did the right thing?

Open your devenv.exe.config found at this path _C:\Users\ARHAZ\AppData\Local\Microsoft\VisualStudio\15.01f228c9d\devenv.exe.config

Find the entry Microsoft.JSON.Core; it will look something like this

`

`

Add a binding redirect line <bindingRedirect oldVersion="1.0.0.0-14.0.0.0" newVersion="15.0.0.0"/>

After updating it will look something like this

`

<bindingRedirect oldVersion="1.0.0.0-14.0.0.0" newVersion="15.0.0.0"/>

`

Save your file and restart Visual Studio.

Try restoring, it should work. Worked for me.

jc-stevens commented 7 years ago

Thanks! That worked for me too!

ibrahimbensalah commented 6 years ago

Worked for me too, although I am using a subtle change of the redirect tag: <bindingRedirect oldVersion="1.0.0.0-15.0.0.0" newVersion="15.0.0.0"/>

Bartmax commented 6 years ago

The fix worked for me. šŸ‘ Thanks @hamzaahmedzia1