locked
Problem building VSIX with MSBuild 2017 RRS feed

  • Question

  • I have upgraded my Package to Visual Studio 2017. In my build process I build a release using the MSBuild command, something like:

    <path>\MSBuild.exe <solution file> /t:Build /p:Configuration=Release

    If I use this command with Visual Studio 2017 RC, then it appears to build correctly, but the VSIX file it generates is invalid. On trying to install the package I get the following error message.

    If I build the package using DevEnv with the command line

    <path>devenv.exe <solution file> /Rebuild Release

    then it also builds the package, but in this case the package is valid

    I have two questions:

    • Am I doing something wrong with, or is it a bug in Visual Studio 2017 RC
    • What does the message "The file is not a valid VSIX package" actually mean?
      Is there any way to debug it?

    Phil

    Monday, December 26, 2016 7:55 AM

All replies

  • What version of MSBuild are you using?  It should be %ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0 (substitute "Developer" or "Enterprise" for "Community" depending on the edition you've got installed).  I've found that using the prior versions of MSBuild don't generate the newer VSIX 3 format.  I haven't seen that particular error, they usually just warn that they may not be compatible when you go to install them and the marketplace won't accept them for upload.

    Eric

    Monday, December 26, 2016 5:02 PM
  • I am using MSBuild from Visual Studio 2017 with the following path:

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe

    Phil

    Monday, December 26, 2016 5:53 PM
  • Hi Phil Jollans,

    Could you please share the install log, if possible, please share a simple demo via OneDrive, which could reproduce the issue.

    Best regards,

    Cole Wu


    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.

    Tuesday, December 27, 2016 1:40 AM
  • Here is the Install Log
    https://1drv.ms/u/s!Ar3aoqbcXHzlgUCtEfe0qyryhD1T

    Here is the "bad" visx file
    https://1drv.ms/u/s!Ar3aoqbcXHzlgT7vz-mN546h1wa1

    Here is the build log
    https://1drv.ms/u/s!Ar3aoqbcXHzlgT-N0ICEwGh6fAtV

    and this is a "good" vsix build in Visual Studio, for comparison
    https://1drv.ms/u/s!Ar3aoqbcXHzlgTzvxqUX-FFKAylx

    Phil

    Tuesday, December 27, 2016 6:17 AM
  • Hi Phil Jollans,

    I download the vsixfile and reproduce the issue on my side, from the build log and install log, I'm not surewhat could cause the issue. please switch to debug mode and press F5 to debug the project, check if it works on debug mode.

    In addition, whatis the previous version of visual studio you are using before you upgrade. please create a simple demo with previous version of visual studio and update to vs2017 and check if it works.


    Best regards,

    Cole Wu


    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.

    Tuesday, December 27, 2016 8:11 AM
  • It is working correctly as a debug version and it is working correctly if I build it in Visual Studio 2017.

    The problem is a difference between building with MSBuild compared to Visual Studio.

    Since - so far as I know - Visual Studio builds internally with MSBuild anyway, this is likely to be a problem with the command line or with the build environment (e.g. path variables).

    By the way, I have also reported this as a bug in VS 2017 RC with the following link:

    https://developercommunity.visualstudio.com/content/problem/9036/building-vsix-with-msbuild-creates-an-invalid-pack.html

    The second problem is interpreting the error message.

    For example, is the XML format in the vsix manifest incorrect, or is a directly referenced file missing, or is a dependent file missing.

    Phil

    Wednesday, December 28, 2016 8:07 AM
  • Hi Phil Jollans,

    >>The problem is a difference between building with MSBuild compared to Visual Studio.

    Please build the project via visual studio (right click project -> build) and check if it works.

    >>The second problem is interpreting the error message.

    Since visual studio is a RC version, maybe it will have some problems. thank you for your feedback. I think it will be solved with the RTM version.

    Best regards,

    Cole Wu


    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.

    Friday, December 30, 2016 8:10 AM
  • The vsix file is actually a zip file. I have taken the good file (build with Visual Studio) and the bad file (build with MSBuild), renamed them to .zip and extracted the contents:

    There are four differences:

    [1]

    In the bad vsix file, the file extension.vsixmanifest is missing the line
    <?xml version="1.0" encoding="utf-8"?>

    [2]

    The file [Content_Types].xml is not identical.

    It is difficult to compare the files, because they contain unformatted XML, but I think the bad one specifies the type vsixmanifest and the good one specifies the type json. Otherwise the definitions are identical.

    [3]

    The bad vsix contains 7 additional files, which are not in the good vsix:

    Microsoft.VisualStudio.OLE.Interop.dll
    Microsoft.VisualStudio.Shell.10.0.dll
    Microsoft.VisualStudio.Shell.Design.dll
    Microsoft.VisualStudio.Shell.Immutable.10.0.dll
    Microsoft.VisualStudio.Shell.Interop.8.0.dll
    Microsoft.VisualStudio.Shell.Interop.9.0.dll
    Microsoft.VisualStudio.Shell.Interop.dll

    [4]

    The good vsix contains two files which are not present in the bad vsix

    catalog.json
    manifest.json

    I have no idea what these differences signify.

    Phil

    Saturday, December 31, 2016 11:45 AM
  • Hi Phil Jollans,

    As I mentioned before, vs2017 is a RC version, Some issue have not been fixed, Since you have post a feedback. I think Microsoft engineers will seriously deal with it.

    Best regards,

    Cole Wu


    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.

    Monday, January 2, 2017 6:48 AM
  • Hi Phil,

    I don't have an exact answer but building within Visual Studio and building with a MSBuild script may be different. For example, MSBuild scripts may use the $(BuildingInsideVisualStudio) property, which is true in the former case but not in the latter case. Or maybe the way to download the latest Nuget packages for the VS SDK is not the same. Or maybe the environment variables are not the same.

    I'd suggest to make a backup copy of your project and then remove things until getting a bare bones extension that reproduces the problem. Then, use the detailed or diagnostics mode to compare the build logs.


    My portal and blog about VSX: http://www.visualstudioextensibility.com
    Twitter: https://twitter.com/VSExtensibility
    MZ-Tools productivity extension for Visual Studio: https://www.mztools.com

    Monday, January 2, 2017 3:46 PM
  • I still think it might be an inconsitency with the MSBuild-versions. You obviously try to install it with the VSIXInstaller from VS2017, but probably for some reason you still BUILD it with an old version of the builder. You certainly know this page already, but it might be worth to give it another try (there is a section "Update the buildtools").

    Thursday, January 19, 2017 2:35 PM
  • This problem seems to be fixed in the most recent Release Candidate.

    Phil

    Saturday, February 25, 2017 5:38 PM