visual-studio-extensionsvsixvsixmanifest

Updating VS Extension from 2015 to 2017 (VSIX v3) makes the package invalid


I have an older extension that i would like to get to work in VS 2017. To be able to do this i understand that i will have to use the new VSIX Manifest v3. The extension works fine in 2015 Update 3. To update it I've done the following:

  1. Open the extension source in VS2017. I'm prompted to do a one-time upgrade, which is completed successfully
  2. Use NuGet to update the Microsot VSSDK BuildTools from 14.x to 15.x
  3. Add the Prerequisite block to the source.extension.vsixmanifest file containing Microsoft.VisualStudio.Component.CoreEditor
  4. Update the Installation target to also support the new Visual studio like so

    <InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Enterprise" />

Builds successfully, but once i open the vsix file in my debug folder, get a message telling me

The file is not a valid VSIX package

If i open up the file using WinRAR i can see that the two mandatory files catalog.json and manifest.json is not in there as they are supposed to in the new v3 format.

What am i missing here ?


Solution

  • It turned out that my problem was, that inside the vbproj file (or csproj for most others) there was an import at the top like so:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.15.1.192\build\Microsoft.VSSDK.BuildTools.props')" />
        <Import Project="..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.props" Condition="Exists('..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.props')" />
        ....
    

    As you can see this project file has imports for both the new version and the old one of the BuildTools. I'm not sure why this happens, as all i did was update the VSSDK BuildTools via NuGet. I also tried to completely uninstall the BuildTools ticking Force uninstall but it seems to have remained through everything I tried.

    So if you experience similar problems, look at your vbproj/csproj file if it has imports for older versions of the Microsoft.VSSDK.BuildTools