Uninstall-Package (Visual Studio のパッケージマネージャーコンソール)Uninstall-Package (Package Manager Console in Visual Studio)
このトピックでは、Windows 上の Visual Studio の パッケージマネージャーコンソール 内のコマンドについて説明します。汎用 PowerShell Uninstall-Package コマンドについては、 Powershell PackageManagement のリファレンスを参照してください。This topic describes the command within the Package Manager Console in Visual Studio on Windows. For the generic PowerShell Uninstall-Package command, see the PowerShell PackageManagement reference.
プロジェクトからパッケージを削除し、必要に応じて依存関係を削除します。Removes a package from a project, optionally removing its dependencies. 他のパッケージがこのパッケージに依存している場合、–Force オプションを指定しない限り、コマンドは失敗します。If other packages depend on this package, the command will fail unless the –Force option is specified.
構文Syntax
Uninstall-Package [-Id] <string> [-RemoveDependencies] [-ProjectName <string>] [-Force]
[-Version <string>] [-WhatIf] [<CommonParameters>]
他のパッケージがこのパッケージに依存している場合、–Force オプションを指定しない限り、コマンドは失敗します。If other packages depend on this package, the command will fail unless the –Force option is specified.
パラメーターParameters
パラメーターParameter | 説明Description |
---|---|
IdId | 必要アンインストールするパッケージの識別子。(Required) The identifier of the package to uninstall. -Id スイッチ自体は省略可能です。The -Id switch itself is optional. |
VersionVersion | アンインストールするパッケージのバージョン。既定では、現在インストールされているバージョンが対象となります。The version of the package to uninstall, defaulting to the currently installed version. |
RemoveDependenciesRemoveDependencies | パッケージとその未使用の依存関係をアンインストールします。Uninstall the package and its unused dependencies. つまり、依存関係に依存する別のパッケージがある場合、その依存関係はスキップされます。That is, if any dependency has another package that depends on it, it's skipped. |
ProjectNameProjectName | パッケージのアンインストール元のプロジェクト。既定のプロジェクトが既定のプロジェクトになります。The project from which to uninstall the package, defaulting to the default project. |
ForceForce | 他のパッケージが依存している場合でも、パッケージを強制的にアンインストールします。Forces a package to be uninstalled, even if other packages depend on it. |
WhatIfWhatIf | 実際にアンインストールを実行せずにコマンドを実行した場合の動作を示します。Shows what would happen when running the command without actually performing the uninstall. |
これらのパラメーターでは、パイプラインの入力やワイルドカード文字を受け入れません。None of these parameters accept pipeline input or wildcard characters.
共通パラメーターCommon Parameters
Uninstall-Package
は、Debug、Error Action、ErrorVariable、OutBuffer、Outbuffer、PipelineVariable、Verbose、Warnings Action、および Warnings 変数の 一般的な PowerShell パラメーターをサポートしています。Uninstall-Package
supports the following common PowerShell parameters: Debug, Error Action, ErrorVariable, OutBuffer, OutVariable, PipelineVariable, Verbose, WarningAction, and WarningVariable.
使用例Examples
# Uninstalls the Elmah package from the default project
Uninstall-Package Elmah
# Uninstalls the Elmah package and all its unused dependencies
Uninstall-Package Elmah -RemoveDependencies
# Uninstalls the Elmah package even if another package depends on it
Uninstall-Package Elmah -Force