Skip to content

Commit d56a11c

Browse files
authored
Merge pull request #119 from UiPath/fix/net47
.Net 4.7
2 parents d68028c + 3de2d3c commit d56a11c

File tree

9 files changed

+38
-39
lines changed

9 files changed

+38
-39
lines changed

.vsts-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ steps:
3636
inputs:
3737
scriptType: "inlineScript"
3838
inlineScript: |
39-
$buildNumber = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$($ENV:BUILD_SOURCESDIRECTORY)\Output\$($ENV:BUILDCONFIGURATION)\net461\UiPath.PowerShell.dll").ProductVersion
39+
$buildNumber = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$($ENV:BUILD_SOURCESDIRECTORY)\Output\$($ENV:BUILDCONFIGURATION)\net472\UiPath.PowerShell.dll").ProductVersion
4040
Write-Host "##vso[build.updatebuildnumber]$buildNumber"
4141
4242
- task: NuGetCommand@2

UiPath.PowerShell.Tests/UiPath.PowerShell.Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net461</TargetFramework>
3+
<TargetFramework>net472</TargetFramework>
44
<OutputPath>$(SolutionDir)\Output\$(Configuration)</OutputPath>
55
<Deterministic>False</Deterministic>
66
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
7+
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
78
</PropertyGroup>
89
<ItemGroup>
910
<Compile Include="..\Properties\GlobalAssemblyInfo.cs">

UiPath.PowerShell.nuspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
<developmentDependency>false</developmentDependency>
1313
<description>An easy to use PowerShell API client for UiPath Orchestrator</description>
1414
<copyright>UiPath</copyright>
15-
<tags>UiPath Orchestrator PowerShell API client </tags>
15+
<tags>PSModule</tags>
1616
</metadata>
1717
<files>
18-
<file src="Output\Release\net461\*.*" target="lib\net461" exclude="**\*Test*;**\*.psd1" />
19-
<file src="Output\Release\net461\UiPath.PowerShell.psd1" target="" exclude="" />
18+
<file src="Output\Release\net472\*.*" target="lib\net472" exclude="**\*Test*;**\*.psd1;**\*.ps1" />
19+
<file src="Output\Release\net472\UiPath.PowerShell.psd1" target="" exclude="" />
20+
<file src="Output\Release\net472\UiPath.BindingResolve.ps1" target="tools" exclude="" />
2021
</files>
2122
</package>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
$OnAssemblyResolve = [System.ResolveEventHandler] {
2+
param($sender, $e)
3+
4+
5+
if ($e.Name.StartsWith("System.Net.Http,"))
6+
{
7+
[system.diagnostics.debug]::WriteLine("Binding redirect $($e.Name) resolved to $($script:httpNet.Location)")
8+
return $script:httpNet
9+
}
10+
11+
return $null
12+
}
13+
14+
trap [System.Exception] { [system.diagnostics.debug]::WriteLine("Exception: $_") }
15+
16+
if ($env:UIPATH_POWERSHELL_SKIP_BINDING_REDIRECT -ne $true)
17+
{
18+
Write-Verbose "Installing assembly resolve binding redirect callback"
19+
# See https://github.com/dotnet/runtime/issues/20777#issuecomment-338418610
20+
$script:httpNet = [reflection.assembly]::Load("System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
21+
[System.AppDomain]::CurrentDomain.add_AssemblyResolve($OnAssemblyResolve)
22+
}

UiPath.PowerShell/UiPath.PowerShell.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net461</TargetFramework>
3+
<TargetFramework>net472</TargetFramework>
44
<OutputPath>$(SolutionDir)\Output\$(Configuration)</OutputPath>
55
<Deterministic>False</Deterministic>
66
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
77
<DocumentationFile>$(OutDir)\UiPath.PowerShell\UiPath.PowerShell.xml</DocumentationFile>
88
<NoWarn>1701;1702;CS1591;CS0618</NoWarn>
9+
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
910
</PropertyGroup>
1011
<ItemGroup>
1112
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0-preview-06">
@@ -33,6 +34,9 @@
3334
<None Include="UiPath.PowerShell.psd1">
3435
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3536
</None>
37+
<None Include="UiPath.BindingResolve.ps1">
38+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
39+
</None>
3640
</ItemGroup>
3741
<ItemGroup>
3842
<ProjectReference Include="..\UiPath.Web.Client\UiPath.Web.Client.csproj" />

UiPath.PowerShell/UiPath.PowerShell.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@{
1010

1111
# Script module or binary module file associated with this manifest.
12-
RootModule = 'lib\net461\UiPath.PowerShell.dll'
12+
RootModule = 'lib\net472\UiPath.PowerShell.dll'
1313

1414
# Version number of this module.
1515
ModuleVersion = '$(UiPathFileVersion)'
@@ -57,7 +57,7 @@ CLRVersion = '4.0'
5757
#RequiredAssemblies = @()
5858

5959
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60-
# ScriptsToProcess = @()
60+
ScriptsToProcess = @('.\tools\UiPath.BindingResolve.ps1')
6161

6262
# Type files (.ps1xml) to be loaded when importing this module
6363
# TypesToProcess = @()

UiPath.PowerShell/Util/BindingResolver.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

UiPath.PowerShell/Util/UiPathCmdlet.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace UiPath.PowerShell.Util
1010
{
1111
public abstract class UiPathCmdlet : PSCmdlet
1212
{
13-
private bool Ignored = BindingResolver.Ignored;
1413
private bool ProtocolIgnored = SecurityProtocolFix.Ignored;
1514

1615
private static RestVerboseTracer VerboseTracer { get; set; }

UiPath.Web.Client/UiPath.Web.Client.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net461</TargetFramework>
3+
<TargetFramework>net472</TargetFramework>
44
<OutputPath>$(SolutionDir)\Output\$(Configuration)</OutputPath>
55
<Deterministic>False</Deterministic>
66
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
77
<NoWarn>1701;1702;CS1591;CS0618</NoWarn>
8+
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
89
</PropertyGroup>
910
<ItemGroup>
1011
<PackageReference Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.1.0" />

0 commit comments

Comments
 (0)