0

Some years ago we made a Visual Studio Add-in, which uses the build events as trigger for the action. The Add-in was working in the IDE and the Command Line mode. To load the Add-in for command-line builds, you had to set the <CommandLineSafe>1</CommandLineSafe> option.

The migrated extension works in the IDE mode, but the extension is not loaded during command-line builds. How is the configuration to load the extension for command-line builds?

Matze
  • 5,100
  • 6
  • 46
  • 69
bfjs
  • 1
  • 1

1 Answers1

0

Information about loading Visual Studio extension packages can be found here: https://msdn.microsoft.com/en-us/library/bb166762.aspx and here: https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.provideautoloadattribute.aspx

You can mark your package class with the ProvideAutoLoadAttribute in combination with an UI context, for instance:

[ProvideAutoLoad(UIContextGuids.EmptySolution)]
public class MyCustomPackage : VSPackage
{
    ...
}

It´s possible to have more than one attribute specified. Available UI contexts are defined by the UIContextGuids type.

In one of my extension I use a combination of the following UI contexts to assure that my package always loads irrespective whether there´s a solution loaded, or not: EmptySolution, NoSolution, SolutionExists.

Matze
  • 5,100
  • 6
  • 46
  • 69
  • I had already these attributes: `[ProvideAutoLoad(UIContextGuids.EmptySolution)] [ProvideAutoLoad(UIContextGuids.NoSolution)] [ProvideAutoLoad(UIContextGuids.SolutionExists)] [ProvideAutoLoad(UIContextGuids.SolutionBuilding)] [ProvideAutoLoad(UIContextGuids.SolutionHasMultipleProjects)] [ProvideAutoLoad(UIContextGuids.SolutionHasSingleProject)] [ProvideAutoLoad(UIContextGuids80.SolutionExistsAndNotBuildingAndNotDebugging)]` in my code. – bfjs Aug 25 '15 at 15:12
  • If I call `%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe /rebuild "Debug|Any CPU" "Solution.sln"` the package is not loaded. – bfjs Aug 25 '15 at 15:22
  • Have you checked the activity log? Maybe there´s a another problem which prevents the extension from loading... – Matze Aug 25 '15 at 17:31
  • From the log: ` 2134 Information VisualStudio Importing pkgdef file C:\USERS\BFJS\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0EXP\EXTENSIONS\BFJS\VSIXPROJECT2\1.0.1\VSIXProject2.pkgdef ` – bfjs Aug 26 '15 at 06:24
  • And: ` 2561 Information Extension Manager Successfully loaded extension... C:\USERS\BFJS\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0EXP\EXTENSIONS\BFJS\VSIXPROJECT2\1.0.1\ ` – bfjs Aug 26 '15 at 06:26
  • And: ` 2565 Information Extension Manager Extension is enabled... C:\USERS\BFJS\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\14.0EXP\EXTENSIONS\BFJS\VSIXPROJECT2\1.0.1\ ` – bfjs Aug 26 '15 at 06:26