locked
Newtonsoft.Json.dll not included in VSIX RRS feed

  • Question

  • I have a package with assemblies that have NuGet references Newtonsoft.Json.dll. The reference in the project says Copy Local = true. Despite this, Newtonsoft.Json.dll is not included in the VSIX. Having read this thread, I'm guessing because msbuild excludes some dlls and I think this is one of them.

    When I run the extension on a test target machine (with VS 2017), it runs successfully.

    A user is saying he's getting a "Could not load file or assembly "Newtonsoft.Json ..." error when running the extension. He is using VS 2015.

    Any ideas?

    Should I create an Asset dependency with type Microsoft.VisualStudio.Assembly in .vsixmanifest for Newtonsoft.Json.dll? I'm guessing msbuild is excluding it for a reason, so I'm not sure.

    I thought this dll would be there already in VS so no need to deploy it. Maybe a versioning issue of the Newtonsoft dll? Maybe specific to VS2015?

    Friday, February 23, 2018 3:51 AM

Answers

  • Hi Christian,

    That isn't a Visual Studio component, so yes you do need to redistribute it if your extension has a dependency on it.

    Setting Copy Local to true, simply ensures the referenced assembly is copied to the project's output directory.

    You're guess right on the money. If you have an extension that's dependent on that assembly, you'll need to add it to the VSIX via the .vsixmanifest.

    Sincerely,


    Ed Dore

    Friday, February 23, 2018 5:32 PM
  • Hi Christian Wade,

    Please check one of Carlos's reply.

    - Open or edit the .vsixmanifest file of your package project

    - Go to Assets section

    - Click the New button

    - Select Type: Microsoft.VisualStudio.Assembly

    - Select Source: File on filesystem

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Saturday, February 24, 2018 6:37 AM

All replies

  • Hi Christian,

    That isn't a Visual Studio component, so yes you do need to redistribute it if your extension has a dependency on it.

    Setting Copy Local to true, simply ensures the referenced assembly is copied to the project's output directory.

    You're guess right on the money. If you have an extension that's dependent on that assembly, you'll need to add it to the VSIX via the .vsixmanifest.

    Sincerely,


    Ed Dore

    Friday, February 23, 2018 5:32 PM
  • Understood, but my concern is that this thread says Copy Local = True should also copy to the VSIX (I have other assemblies that get into the VSIX just using CopyLocal=True). However the msbuild system specifically excludes a defined list of assemblies (which happens to include Newtonsoft.Json.dll). I'm guessing they have a reason not to include it? Depending on the reason, is it safe for me to do it?

    Friday, February 23, 2018 5:50 PM
  • Hi Christian Wade,

    Please check one of Carlos's reply.

    - Open or edit the .vsixmanifest file of your package project

    - Go to Assets section

    - Click the New button

    - Select Type: Microsoft.VisualStudio.Assembly

    - Select Source: File on filesystem

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Saturday, February 24, 2018 6:37 AM
  • I reproed the problem on VS2015. I then embedded it using a VSIX manifest item and tested it on VS2015 and VS2017. Both worked. I'm waiting for the users to test it now and confirm.

    I'm still interested why it's excluded from copylocal=true by the VSIX build, and if anyone has experienced issues with this.

    I'm also interested in why this suddenly started happening. I've had VS2015 clients for a long time and this was not a problem. I'm guessing the exclusion of the Newtonsoft dll from the VSIX build is a new thing.

    In meantime, I'm marking as answers anyway. Thanks.

    Sunday, February 25, 2018 5:31 PM
  • Hi,

    I'm facing the same issue, I open this issue here , but, even I insert in vsixmanifest as an asset, the newtonsoft.json.dll is still excluded. I made my vsix package and try to run, without the newtonsoft in vsix package, in VS2017 15.3, 15.4, 15.5, 15.6 and it doesn't work in any machine.

    If I had as an Asset, it's excluded, it's only inserted if I insert as an Asset and dll is in the same folder of project, it does not accept if I choose file on system and try to insert relative path.

    I want to have this dll from bin folder to make sure version is the same as the installed version on nuget package.

    Please let me know how do you fix that. My work arround was remove the vsix exclusion from "Microsoft.VsSDK.targets".

    Thank you,

    Saturday, April 28, 2018 8:43 PM