Adding dependency loading mechansim for NetCore
This commit is contained in:
Родитель
546bdcf96f
Коммит
43b095e263
|
@ -69,9 +69,6 @@ RequiredAssemblies = '.\Microsoft.Azure.PowerShell.Authentication.Abstractions.d
|
||||||
'.\Microsoft.Azure.PowerShell.Websites.dll',
|
'.\Microsoft.Azure.PowerShell.Websites.dll',
|
||||||
'.\Hyak.Common.dll', '.\Microsoft.ApplicationInsights.dll',
|
'.\Hyak.Common.dll', '.\Microsoft.ApplicationInsights.dll',
|
||||||
'.\Microsoft.Azure.Common.dll',
|
'.\Microsoft.Azure.Common.dll',
|
||||||
'.\Microsoft.IdentityModel.Clients.ActiveDirectory.dll',
|
|
||||||
'.\Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll',
|
|
||||||
'.\Microsoft.IdentityModel.Tokens.dll',
|
|
||||||
'.\Microsoft.Rest.ClientRuntime.dll',
|
'.\Microsoft.Rest.ClientRuntime.dll',
|
||||||
'.\Microsoft.Rest.ClientRuntime.Azure.dll',
|
'.\Microsoft.Rest.ClientRuntime.Azure.dll',
|
||||||
'.\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll',
|
'.\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll',
|
||||||
|
|
|
@ -36,9 +36,17 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Newtonsoft.Json.9.dll"/>
|
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Newtonsoft.Json.9.dll"/>
|
||||||
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Newtonsoft.Json.10.dll"/>
|
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Newtonsoft.Json.10.dll"/>
|
||||||
|
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"/>
|
||||||
|
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<NetCoreAssemblies Include="$(ProjectDir)..\..\..\lib\netcore\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"/>
|
||||||
|
<NetCoreAssemblies Include="$(ProjectDir)..\..\..\lib\netcore\Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
<StorageDependencies Include="$(ProjectDir)..\..\..\lib\Microsoft.WindowsAzure.Storage.dll"/>
|
<StorageDependencies Include="$(ProjectDir)..\..\..\lib\Microsoft.WindowsAzure.Storage.dll"/>
|
||||||
<StorageDependencies Include="$(ProjectDir)..\..\..\lib\Microsoft.WindowsAzure.Storage.DataMovement.dll"/>
|
<StorageDependencies Include="$(ProjectDir)..\..\..\lib\Microsoft.WindowsAzure.Storage.DataMovement.dll"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -81,6 +89,7 @@
|
||||||
|
|
||||||
<Target Name="CopyFiles" AfterTargets="Build">
|
<Target Name="CopyFiles" AfterTargets="Build">
|
||||||
<Copy SourceFiles="@(PreLoadAssemblies)" DestinationFolder="$(TargetDir)\PreloadAssemblies" />
|
<Copy SourceFiles="@(PreLoadAssemblies)" DestinationFolder="$(TargetDir)\PreloadAssemblies" />
|
||||||
|
<Copy SourceFiles="@(NetCoreAssemblies)" DestinationFolder="$(TargetDir)\NetCoreAssemblies" />
|
||||||
<Copy SourceFiles="@(StorageDependencies)" DestinationFolder="$(TargetDir)" />
|
<Copy SourceFiles="@(StorageDependencies)" DestinationFolder="$(TargetDir)" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичные данные
src/lib/netcore/Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll
Normal file
Двоичные данные
src/lib/netcore/Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll
Normal file
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -21,6 +21,25 @@ if($PSEdition -eq 'Desktop' -and (Test-Path $preloadPath))
|
||||||
catch {}
|
catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$netCorePath = (Join-Path $PSScriptRoot -ChildPath "NetCoreAssemblies")
|
||||||
|
if($PSEdition -eq 'Core' -and (Test-Path $netCorePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$loadedAssemblies = ([System.AppDomain]::CurrentDomain.GetAssemblies() | %{New-Object -TypeName System.Reflection.AssemblyName -ArgumentList $_.FullName} )
|
||||||
|
Get-ChildItem -Path $netCorePath -Filter "*.dll" | ForEach-Object {
|
||||||
|
$assemblyName = ([System.Reflection.AssemblyName]::GetAssemblyName($_.FullName))
|
||||||
|
$matches = ($loadedAssemblies | Where-Object {$_.Name -eq $assemblyName.Name})
|
||||||
|
if (-not $matches)
|
||||||
|
{
|
||||||
|
[System.Reflection.Assembly]::Load([System.IO.File]::ReadAllBytes($_.FullName))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
%IMPORTED-DEPENDENCIES%
|
%IMPORTED-DEPENDENCIES%
|
||||||
|
|
||||||
if (Test-Path -Path "$PSScriptRoot\StartupScripts")
|
if (Test-Path -Path "$PSScriptRoot\StartupScripts")
|
||||||
|
|
|
@ -42,13 +42,15 @@
|
||||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.0.4" IncludeAssets="All" />
|
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.0.4" IncludeAssets="All" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="[10.0.3]" />
|
<PackageReference Include="Newtonsoft.Json" Version="[10.0.3]" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Microsoft.IdentityModel.Client.ActiveDirectory" Version="3.19.2">
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
|
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
|
||||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.0-rc.1" IncludeAssets="All" />
|
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.0-rc.1" IncludeAssets="All" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Microsoft.IdentityModel.Client.ActiveDirectory" Version="3.19.2">
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
||||||
|
|
Загрузка…
Ссылка в новой задаче