Wrong file added by the VSIX

Category: visual studio extensibility

Question

ChristerEriksson on Mon, 18 Jan 2016 09:58:17


I ctrated a VSIX-package that uses Newtonsoft.Json.dll. I Added the Newtonsoft.Json NuGet package to my VSIX-Project and the Newtonsoft.Json.dll file is installed in the experimantal instance of Visual Studio when I debug my project.

This weekend I downloaded the code at home and run into some isues. The Newtonsoft.Json.dll file that is added to the experimantal instance at the path C:\Users\[User]\AppData\Local\Microsoft\VisualStudio\14.0Exp\Extensions\Christer Eriksson\ProjectTemplateTutorial.VSIXProject\1.0 has another version than the Newtonsoft.Json.dll in the VSIX-package.

The Newtonsoft.Json.dll installed in the experimental instance has the version 6.0.8.18111

The Newtosoft.Json.dll in the VSIX-package has the version 8.0.2.19309

Where does the 6.0.8.18111 file come from? And why is this working on one dev machine and not the another?

I have installed Visual Studio 2015 Update 1 on Windows 10.

All the code for this project is on Github.

/Christer Eriksson

// Update : Found where the file is copied

I found someting strange in the MSBuild Log.

Target "GetVsixSourceItems" skipped. Previously built successfully.
Target "DeployVsixExtensionFiles" in file "C:\GIT\ProjectTemplateTutorial\Source\packages\Microsoft.VSSDK.BuildTools.14.1.24720\tools\VSSDK\Microsoft.VsSDK.targets" from project "C:\GIT\ProjectTemplateTutorial\Source\ProjectTemplateTutorial.VSIXProject\ProjectTemplateTutorial.VSIXProject.csproj" (target "PrepareForRun" depends on it):
Task "UninstallExtension" skipped, due to false condition; ('$(ExistingDeploymentPath)' != '$(VsixDeploymentPath)' AND '$(ExistingDeploymentPath)' != '' AND '$(AllUsersExtension)' != 'true') was evaluated as ('C:\USERS\CHRISTER\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0EXP\EXTENSIONS\CHRISTER ERIKSSON\PROJECTTEMPLATETUTORIAL.VSIXPROJECT\1.0\' != 'C:\Users\Christer\AppData\Local\Microsoft\VisualStudio\14.0Exp\Extensions\Christer Eriksson\ProjectTemplateTutorial.VSIXProject\1.0\' AND 'C:\USERS\CHRISTER\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0EXP\EXTENSIONS\CHRISTER ERIKSSON\PROJECTTEMPLATETUTORIAL.VSIXPROJECT\1.0\' != '' AND 'False' != 'true').
Task "Message"
  Task Parameter:Text=VsixID = ProjectTemplateTutorial.VSIXProject.Christer Eriksson.3c813382-89dc-4efd-ac34-8e8b04c99d2d
  VsixID = ProjectTemplateTutorial.VSIXProject.Christer Eriksson.3c813382-89dc-4efd-ac34-8e8b04c99d2d
Done executing task "Message".
Task "Message"
  Task Parameter:Text=VsixVersion = 1.0
  VsixVersion = 1.0
Done executing task "Message".
Task "Message"
  Task Parameter:Text=VsixDeploymentPath = C:\Users\Christer\AppData\Local\Microsoft\VisualStudio\14.0Exp\Extensions\Christer Eriksson\ProjectTemplateTutorial.VSIXProject\1.0\
  VsixDeploymentPath = C:\Users\Christer\AppData\Local\Microsoft\VisualStudio\14.0Exp\Extensions\Christer Eriksson\ProjectTemplateTutorial.VSIXProject\1.0\
Done executing task "Message".
Added Item(s):
    VsixExtensionFiles=
        obj\Debug\ProjectTemplateTutorial.VSIXProject.dll
                VSIXSubPath=
        C:\GIT\ProjectTemplateTutorial\Source\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll
                CopyLocal=true
                FusionName=Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
                HintPath=..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll
                ImageRuntime=v4.0.30319
                OriginalItemSpec=Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL
                Private=True
                ReferenceSourceTarget=ResolveAssemblyReference
                ResolvedFrom={HintPathFromItem}
                Version=8.0.0.0
                VSIXSubPath=
        C:\GIT\ProjectTemplateTutorial\Source\ProjectTemplateTutorial.Helpers\bin\Debug\ProjectTemplateTutorial.Helpers.dll
                BuildReference=true
                Configuration=Debug
                CopyLocal=true
                FullConfiguration=Debug|AnyCPU
                FusionName=ProjectTemplateTutorial.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b490d4518b7bc751
                ImageRuntime=v4.0.30319
                MSBuildSourceProjectFile=C:\GIT\ProjectTemplateTutorial\Source\ProjectTemplateTutorial.Helpers\ProjectTemplateTutorial.Helpers.csproj
                MSBuildSourceTargetName=Build
                Name=ProjectTemplateTutorial.Helpers
                OriginalItemSpec=C:\GIT\ProjectTemplateTutorial\Source\ProjectTemplateTutorial.Helpers\bin\Debug\ProjectTemplateTutorial.Helpers.dll
                OriginalProjectReferenceItemSpec=..\ProjectTemplateTutorial.Helpers\ProjectTemplateTutorial.Helpers.csproj
                OutputItemType=
                Platform=AnyCPU
                Project={4636c99e-70af-421b-8dee-2542c00751d5}
                ProjectReferenceOriginalItemSpec=..\ProjectTemplateTutorial.Helpers\ProjectTemplateTutorial.Helpers.csproj
                ReferenceOutputAssembly=true
                ReferenceSourceTarget=ProjectReference
                ResolvedFrom=C:\GIT\ProjectTemplateTutorial\Source\ProjectTemplateTutorial.Helpers\bin\Debug\ProjectTemplateTutorial.Helpers.dll
                SetConfiguration=Configuration=Debug
                SetPlatform=Platform=AnyCPU
                Targets=
                Version=1.0.0.0
                VSIXSubPath=
        obj\Debug\ProjectTemplateTutorial.VSIXProject.pkgdef
                VSIXSubPath=
        obj\Debug\extension.vsixmanifest
        C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.8\bin\plugins\Diagnostics\Newtonsoft.Json.dll
                BuildReference=true
                Configuration=Debug
                CopyLocal=true
                FullConfiguration=Debug|AnyCPU
                FusionName=Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
                HintPath=..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.1.24720\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll
                ImageRuntime=v4.0.30319
                IncludeOutputGroupsInVSIX=BuiltProjectOutputGroupDependencies
                IncludeOutputGroupsInVSIXLocalOnly=DebugSymbolsProjectOutputGroup;
                MSBuildSourceProjectFile=C:\GIT\ProjectTemplateTutorial\Source\ProjectTemplateTutorial.Helpers\ProjectTemplateTutorial.Helpers.csproj
                MSBuildSourceTargetName=BuiltProjectOutputGroupDependencies
                Name=ProjectTemplateTutorial.Helpers
                OriginalItemSpec=Microsoft.VisualStudio.Shell.Immutable.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
                OutputItemType=
                Platform=AnyCPU
                Private=True
                Project={4636c99e-70af-421b-8dee-2542c00751d5}
                ReferenceOutputAssembly=true
                ReferenceSourceTarget=ResolveAssemblyReference
                ResolvedFrom={Registry:Software\Microsoft\.NETFramework,v4.6.1,AssemblyFoldersEx}
                SetConfiguration=Configuration=Debug
                SetPlatform=Platform=AnyCPU
                Targets=
                Version=6.0.0.0

We can se that the Newtonsoft.Json.dll file is copied from the packages folder and then from the Azure SDK. The difference between mydev machines is that the one that the project works on has the Azure SDK 2.7 installed and the machine it fails on has the Azure SDK 2.8 installed. In the Azure SDK 2.8 the Newtonsoft.Json.dll is located C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.8\bin\plugins\Diagnostics\Newtonsoft.Json.dll but in the Azure SDK 2.7 there is no Newtonsoft.Json.dll at that location.

// Update : Workaround

If I put my DteExtensions class in the VSIXProject and delete the Helpers project everyting works as expected again. But if I have my DTEExtensions class in a classlibrary project (Helpers) i get this error if I have the Azure SDK 2.8 installed.

I still can't figure out why this is happening.

//Update : Today it works! :(

Today I created a new Visual Studio machine in Azure to reproduce my problem in a smaller project. Turns out that today when i clone my project from Github it works just fine. I used the same image in azure to create the dev machine as yesterday and cloned the same code. Problem magicaly solved it self.

Replies

Weiwei Cai on Tue, 19 Jan 2016 06:29:45


Hi ChristerEriksson,

This forum is discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

Since your problem is more related to Visual Studio Extensions/Integrate, I help you move this thread to Visual Studio Integrate forum for a better help.

Best Regards,
Weiwei

ChristerEriksson on Tue, 19 Jan 2016 07:29:44


Thanks!

/Christer

DotNet Wang on Wed, 20 Jan 2016 02:44:43


Hi ChristerEriksson,

I am glad to hear that your issue is fixed. Any updates, please remind me.

Best Regards,
Li Wang