Allows commands to be sent to the VisualStudio package management console from the command line.
For this to work, you need to make sure that you have VisualStudio installed on the system. The version assumed is VS2015, but it should work for any VisualStudio version.
Make sure that the full project path is used. The command interface for DTE does not like relative paths.
PMCCommand 1.0.0
-n, --nugetcommand Required. The NuGet package management console command
to execute.
-p, --project Required. The full path of the .csproj or .sln file in
which to run the command.
-v, --vsversion (Default: 15.0) The VisualStudio version for DTE
interaction.
-d, --debug (Default: False) Print debuging output to the console.
--help Display this help screen.
Example:
PMCCommand.exe --nugetcommand "Update-Package Newtonsoft.Json" --project "C:\Foo\Bar\foobar.csproj"
Errors experienced in the nuget command line interface are printed out after running.
Update-Package : 'blah' was not installed in any project. Update failed.
At line:1 char:1
+ Update-Package blah; $error > C:\Windows\TEMP\tmpF776.tmp ; "False" > C:\Windows
...
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement
.PowerShellCmdlets.UpdatePackageCommand
The additional commands after the Update-Package blah command are to ensure that errors are captured, and that execution of the main STAThread does not continue until AFTER the nuget command is completed.
Make sure that the user that will be doing the action has the appropriate rights. This StackOverflow Answer addresses the specific problem. Instead of applying the changes to Microsoft Word Document set it for Microsoft Visual Studio <version>.
If you continue to have issues, it MAY be due to the executable being compiled for Any CPU. Compile for x86 and try again.
- Get DTE Reference
- NuGet Package Management Console Command GUIDs and IDs
- Visual Studio Commands
- Helpful MSDN List, just look for GUIDs in there.
- Just recursively grep for the GUID/ID in that directory to see the origin of a given GUID or Command ID (
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VSSDK\VisualStudioIntegration\Common\Incfor my machine)
- Nuget Issue that spurned this work
- Using Messagefilter for DTE COM interactions
- COM IDs in a Nutshell