View Single Post
Old 07-28-2006   #2 (permalink)
Alan Taylor


 
 

Re: PSSnapIn InstallUtil Problem -- "That assembly does not allow partially trusted callers.."

Just to complete the loop, I found the following article on the PowerShell
Team Blog:

"The worlds easiest way to create/install MshSnapins"
http://blogs.msdn.com/powershell/arc...25/583258.aspx

With a few obvious changes the script works with Powershell and you don't
have to do the SnapIn code.

Alan


"Alan Taylor" <alan DOT ML @T geemail D_OT com> wrote in message
news:OLINBjZsGHA.4608@TK2MSFTNGP04.phx.gbl...
> I'm trying to create my first PSSnapIn. However, I'm getting "That

assembly
> does not allow partially trusted callers.." when attempting an installutil
> on the compiled DLL.
>
> I'm going for the minimalist approach and not using Visual Studio to
> generate "AssemblyInfo.cs" or csproj files. Is that what is messing me

up?
> Is there a way to use another editor to create the cmdlet and snapin CS
> files then just compile and install them?
>
> Please pardon my C# workflow ignorance.
>
> Thanks,
> Alan
>
>
> PS C:\> &$compiler /target:library /r:$ref bar.cs |
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe -i bar.dll
> Microsoft (R) .NET Framework Installation utility Version 2.0.50727.42
> Copyright (c) Microsoft Corporation. All rights reserved.
>
>
> Running a transacted installation.
>
> Beginning the Install phase of the installation.
> See the contents of the log file for the C:\bar.dll assembly's progress.
> The file is located at C:\bar.InstallLog.
> Installing assembly 'C:\bar.dll'.
> Affected parameters are:
> logtoconsole =
> assemblypath = C:\bar.dll
> i =
> logfile = C:\bar.InstallLog
> Unable to create an instance of the foo.SnapIn installer type.
> System.Reflection.TargetInvocationException: Exception has been thrown by
> the target of an invocation.
> The inner exception System.Security.SecurityException was thrown with the
> following error message: That assembly does not allow partially trusted
> callers..
>
> An exception occurred during the Install phase.
> System.InvalidOperationException: Unable to create an instance of the
> foo.SnapIn installer type.
> The inner exception System.Reflection.TargetInvocationException was thrown
> with the following error message: Exception has been thrown by the target

of
> an invocation..
> The inner exception System.Security.SecurityException was thrown with the
> following error message: That assembly does not allow partially trusted
> callers..
>
> The Rollback phase of the installation is beginning.
> See the contents of the log file for the C:\bar.dll assembly's progress.
> The file is located at C:\bar.InstallLog.
> Rolling back assembly 'C:\bar.dll'.
> Affected parameters are:
> logtoconsole =
> assemblypath = C:\bar.dll
> i =
> logfile = C:\bar.InstallLog
> Unable to create an instance of the foo.SnapIn installer type.
> System.Reflection.TargetInvocationException: Exception has been thrown by
> the target of an invocation.
> The inner exception System.Security.SecurityException was thrown with the
> following error message: That assembly does not allow partially trusted
> callers..
> An exception occurred during the Rollback phase of the
> System.Configuration.Install.AssemblyInstaller installer.
> System.InvalidOperationException: Unable to create an instance of the
> foo.SnapIn installer type.
> The inner exception System.Reflection.TargetInvocationException was thrown
> with the following error message: Exception has been thrown by the target

of
> an invocation..
> The inner exception System.Security.SecurityException was thrown with the
> following error message: That assembly does not allow partially trusted
> callers..
> An exception occurred during the Rollback phase of the installation. This
> exception will be ignored and the rollback will continue. However, the
> machine might not fully revert to its initial state after the rollback is
> complete.
>
> The Rollback phase completed successfully.
>
> The transacted install has completed.
> The installation failed, and the rollback has been performed.
>
>



My System SpecsSystem Spec