1

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?

devlife
  • 13,287
  • 23
  • 70
  • 126

2 Answers2

3

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.

JPBlanc
  • 63,198
  • 12
  • 118
  • 155
  • That was it. I needed to use the x64 version of installutil. It's interesting that I didn't get an error message or something using the x86 version. – devlife Oct 04 '11 at 16:29
1

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.

Richard
  • 100,436
  • 21
  • 189
  • 251
  • I fully agree with this, I don't put it in my answer because it look like "Tell me what you need, and I'll tell you how to get along without it." ;o) – JPBlanc Oct 04 '11 at 07:18
  • Really the only reason that I want to install the snapin is so I can use the Cmdlet Help Editor: http://blogs.msdn.com/b/powershell/archive/2011/02/24/cmdlet-help-editor-v2-0-with-module-support.aspx – devlife Oct 04 '11 at 16:28
  • @devlife Sounds like a reasonable reason... but that link says the tool has been updated to support modules as well as snapins. – Richard Oct 05 '11 at 07:01
  • @Richard I know it does! However, it wasn't working for the module either. It has been made open source so I'm gonna debug and see what the issue is. – devlife Oct 05 '11 at 16:27