Quantcast
Channel: MSBuild forum
Viewing all articles
Browse latest Browse all 2763

RunspaceFactory.CreateRunspace causes CLR error.

$
0
0

I have an application that uses PowerShell to check the status of a particular service on a remote server.  The app runs fine on my Windows 8 development computer but generates an error when published via click-once to a Windows 2008 R2 server. The error occurs on the CreateRunspace command.  Here is the code (I'm using Visual Studio 2013 - Basic Language):

            Dim connectionInfo As New WSManConnectionInfo(serverUri, SHELL_URI, remotecred)
            Dim myRunSpace As Runspace = RunspaceFactory.CreateRunspace(connectionInfo)

As soon as the program hits the 2nd line above, I get the following error:

"Common Language Runtime detected an invalid program"

I thought at first that it might have something to do with the "Target CPU" setting but it does not seem to have any effect.  I have also included all references in the "Application Files" section of the Publish page but that doesn't work either.  I read somewhere to try the "Clean" function on my app but that did not work.

Can anyone suggest what to try next?

Thanks.

Mike


"MC"



Viewing all articles
Browse latest Browse all 2763

Trending Articles