I cannot get the Rebex libraries to load in PowerShell.

Exception calling "Load" with "1" argument(s): "Could not load file or assembly 'Rebex.Mail' or one of its dependencies. The system cannot find the file specified." At line:1 char:28 + [Reflection.Assembly]::Load <<<< ("Rebex.Mail") + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : DotNetMethodException

and

using the path with [Reflection.Assembly]::LoadFrom() gives the same error.

Thanks!

asked 29 Sep '11, 00:09

rDrown888's gravatar image

rDrown888
15
accept rate: 0%


well you are using .NET4, so you need to tell powershell to load the .NET4 environment

"The solution is pretty simple – just tell PowerShell to use a later version of the CLR. To do this, you need to create a config file, named PowerShell.Exe.Config, located in the same folder as PowerShell.Exe (and another one for PowerShellISE.Exe, or PowerShellISE.Exe.Config). These config files contain a small bit of XML to tell the system which version of the CLR to use. To access the .NET 4.0 versions, use the following:"

<?xml version="1.0"?> <configuration>

<startup useLegacyV2RuntimeActivationPolicy="true">

    <supportedRuntime version="v4.0.30319"/> 
    <supportedRuntime version="v2.0.50727"/> 
</startup>  </configuration>

see http://tfl09.blogspot.com/2010/08/using-newer-versions-of-net-with.html

link

answered 29 Sep '11, 14:51

rDrown888's gravatar image

rDrown888
15
accept rate: 0%

If you don't need any .NET4 features in PowerShell, an easier solultion would be to simply use .NET2 build of Rebex Mail.

(29 Sep '11, 15:39) Lukas Pokorny ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×53

Asked: 29 Sep '11, 00:09

Seen: 413 times

Last updated: 29 Sep '11, 15:39