1

I'm creating a VISX project. It runs normally, but after I update all it's nuget packages, it start to show errors when I try to run it in the Visual Studio Experimental Instance.

I tried to revert the packages, but it seems that some packages versions are no longer available for download.

The main reason is that the VISX can't load the Microsoft.VisualStudio.Threading assembly after the dependecies are updated.

I tried adding the assembly to the package's Assets too. The VISX can load it now, but can't find the following method in the AsyncPackage class, like it would be loading the wrong assembly version.

JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

There's also the same error (assembly not found) for the Newtonsoft.Json dependency.

Can someone help me with this?


I zipped everything and upload in my onedrive: https://1drv.ms/u/s!AmhLdtS8gKjrl71Vmnp85m4ZPUILgw

I included all packages, since there's a chance that who download the project could not execute it because the packages could not be downloaded from nuget.org.

To simulate the error, just update the dependencies.


Update 1

As suggested, I was able to redo the entire project using "package reference" to target dependencies.

The visx builds and work, but the problem with the dependency for Newtonsoft.Json still occurs. Also, I tried adding another dependency from a nuget package that I created, and the same error occurs too.

I wrote a piece of code that uses JsonConvert just to make use of the dependency. When I execute the "TestCommand" from VS Experimental instance, them the error popups.

enter image description here

enter image description here

Link for the second project in my onedrive: https://1drv.ms/u/s!AmhLdtS8gKjrl71ZCd1WIYNDTZaSCw

Thiago Romam
  • 439
  • 4
  • 14
  • I would recommend first to migrate your nuget reference mode from packages.config to packagereference: https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files I don't guarantee anything, but my experience is it works better with VS extensibility. So basically what you would do is 1) remove all your VS refs, even those not in packages.config, like EnvDTE, etc. just keep the system ones. 2) change your nuget mode to packagereference, 3) add needed references using manage nuget again. Most of the time, you don't need to add exact same set as some include others – Simon Mourier Jun 12 '18 at 05:44
  • Hi Simon. I tried your suggestion and updated the question. Please take a look on the "Update 1" part. – Thiago Romam Jun 15 '18 at 03:29
  • You know what? I had the exact same problem, but I managed to fix it. Here is my project: https://1drv.ms/u/s!AsmmEDGvydk2jwP-PyO4ZabsQ26H to fix the dependency issue, I had to use the trick I describe here: https://stackoverflow.com/questions/43726044/how-to-include-assemblies-from-nuget-packages-in-a-vsix-installer/50679442 check the .csproj, I added a `` manually to the .csproj. For some reason, VS doesn't pick newtonsoft.json. It could work with other refs – Simon Mourier Jun 15 '18 at 05:00
  • You can check beforehand what will be installed in your extension, you can just open the output .vsix file with a tool like 7-zip directly (.vsix is just a .zip and 7-zip doesn't really care if the extension is .zip or not). You'll see what's going to be installed in the target system. With my trick, you'll see newtonsoft.json.dll is embedded in the .vsix – Simon Mourier Jun 15 '18 at 05:03

0 Answers0