No installers found when running install util on custom pssnapin
-
06-02-2021 - |
質問
I created a very simple PSSnapin but when I go to run IntallUtil against the assembly I get the following:
No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\Tools\PowerShellCommands\SetServerDataSource\bin\Debug\SetServerDataSource.dll assembly. Remove InstallState file because there are no installers.
However, I definitely have an installer (inherited from CustomPSSnapIn) with [RunInstaller(true)]:
[RunInstaller(true)]
public class SetServerDataSourcePSSnapIn : CustomPSSnapIn
{
///
}
Any ideas?
解決
Be carefull to install it with the good InstallUtil.exe. It exists a 64 bits ans a 32 bits.
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe
Versus
C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe
You may adapt this to the framework in usage in your company. It depends from where you referenced System.Management.Automation
. On a 64bit computer if you do it from :
C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0
Its a 64Bis assembly.
他のヒント
When I've done this, I've just applied [RunInstaller(true)]
to the PSSnapIn
derived class that defines the snapin.
However, unless you really must support PowerShell V1, it would be better to create a (binary) module and have no need for an installer.