proxb / PoshRSJob

Provides an alternative to PSjobs with greater performance and less overhead to run commands in the background, freeing up the console and allowing throttling on the jobs.
MIT License
541 stars 87 forks source link

Add-Type -Language CSharpVersion3 #23

Closed EsOsO closed 9 years ago

EsOsO commented 9 years ago

On my system (Windows 8.1 - PSVersion 4.0) I have this error:

PS D:\Learning> Import-Module poshrsjob -verbose
VERBOSE: Loading module from path 'D:\Tools\Powershell\Modules\poshrsjob\poshrsjob.psd1'.
VERBOSE: Loading module from path 'D:\Tools\Powershell\Modules\poshrsjob\PoshRSJob.psm1'.
Add-Type : Cannot add type due to the following exception: Compiler executable file csc.exe cannot be found.. Verify
that Microsoft .NET Framework 3.5  is installed. On x64-based versions of Windows, you must also install the WOW64
feature.
At D:\Tools\Powershell\Modules\poshrsjob\PoshRSJob.psm1:4 char:1
+ Add-Type -TypeDefinition @"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-Type], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.AddTypeCommand

VERBOSE: Importing function 'Get-RSJob'.
VERBOSE: Importing function 'Receive-RSJob'.
VERBOSE: Importing function 'Remove-RSJob'.
VERBOSE: Importing function 'Start-RSJob'.
VERBOSE: Importing function 'Stop-RSJob'.
VERBOSE: Importing function 'Wait-RSJob'.
VERBOSE: Importing alias 'gsj'.
VERBOSE: Importing alias 'rmsj'.
VERBOSE: Importing alias 'rsj'.
VERBOSE: Importing alias 'spsj'.
VERBOSE: Importing alias 'ssj'.
VERBOSE: Importing alias 'wsj'.

Changing -Language CSharpVersion3 to -Language CSharp solves the problem

proxb commented 9 years ago

Updated the code to use CSharp in compiling the C# class.