Browse Source

Downgrade to .NETStandard1.5

pull/875/head
Nikita Tsukanov 10 years ago
parent
commit
a5467c31e5
  1. 5
      build.cake
  2. 40
      src/Avalonia.DotNetCoreRuntime/NetCoreRuntimePlatform.cs
  3. 10
      src/Avalonia.DotNetCoreRuntime/project.json

5
build.cake

@ -311,8 +311,7 @@ var nuspecNuGetSettingsCore = new []
new NuSpecDependency() { Id = "Sprache", Version = SpracheVersion }, new NuSpecDependency() { Id = "Sprache", Version = SpracheVersion },
new NuSpecDependency() { Id = "System.Reactive", Version = SystemReactiveVersion }, new NuSpecDependency() { Id = "System.Reactive", Version = SystemReactiveVersion },
new NuSpecDependency() { Id = "System.Threading.ThreadPool", TargetFramework = "netcoreapp1.0", Version = "4.3.0" }, new NuSpecDependency() { Id = "System.Threading.ThreadPool", TargetFramework = "netcoreapp1.0", Version = "4.3.0" },
new NuSpecDependency() { Id = "Microsoft.Extensions.DependencyModel", TargetFramework = "netcoreapp1.0", Version = "1.1.0" }, new NuSpecDependency() { Id = "NETStandard.Library", TargetFramework = "netcoreapp1.0", Version = "1.6.0" },
new NuSpecDependency() { Id = "NETStandard.Library", TargetFramework = "netcoreapp1.0", Version = "1.6.1" },
new NuSpecDependency() { Id = "Microsoft.NETCore.Portable.Compatibility", TargetFramework = "netcoreapp1.0", Version = "1.0.1" } new NuSpecDependency() { Id = "Microsoft.NETCore.Portable.Compatibility", TargetFramework = "netcoreapp1.0", Version = "1.0.1" }
}, },
Files = coreLibrariesNuSpecContent Files = coreLibrariesNuSpecContent
@ -792,7 +791,7 @@ Task("Zip-Files")
}); });
Task("Create-NuGet-Packages") Task("Create-NuGet-Packages")
//.IsDependentOn("Build") .IsDependentOn("Run-Unit-Tests")
.Does(() => .Does(() =>
{ {
foreach(var nuspec in nuspecNuGetSettings) foreach(var nuspec in nuspecNuGetSettings)

40
src/Avalonia.DotNetCoreRuntime/NetCoreRuntimePlatform.cs

@ -5,8 +5,6 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.Extensions.DependencyModel;
namespace Avalonia.Shared.PlatformSupport namespace Avalonia.Shared.PlatformSupport
{ {
@ -14,31 +12,33 @@ namespace Avalonia.Shared.PlatformSupport
{ {
public Assembly[] GetLoadedAssemblies() public Assembly[] GetLoadedAssemblies()
{ {
List<Assembly> assemblies = new List<Assembly>();
// Mostly copy-pasted from (MIT): var rv = new List<Assembly>();
// https://github.com/StefH/System.AppDomain.Core/blob/0b35e676c2721aa367b96e62eb52c97ee0b43a70/src/System.AppDomain.NetCoreApp/AppDomain.cs var entry = Assembly.GetEntryAssembly();
foreach (var assemblyName in DependencyContext.Default.GetRuntimeAssemblyNames(RuntimeEnvironment.GetRuntimeIdentifier())) rv.Add(entry);
var queue = new Queue<AssemblyName>(entry.GetReferencedAssemblies());
var aset = new HashSet<string>(queue.Select(r => r.ToString()));
while (queue.Count > 0)
{ {
Assembly asm;
try try
{ {
try asm = Assembly.Load(queue.Dequeue());
{ }
var assembly = Assembly.Load(assemblyName); catch (Exception e)
// just load all types and skip this assembly if one or more types cannot be resolved {
assembly.DefinedTypes.ToArray(); Debug.Write(e.ToString());
assemblies.Add(assembly); continue;
}
catch (Exception ex)
{
Debug.Write(ex.Message);
}
} }
catch (Exception ex) rv.Add(asm);
foreach (var r in asm.GetReferencedAssemblies())
{ {
Debug.Write(ex.Message); if (aset.Add(r.ToString()))
queue.Enqueue(r);
} }
} }
return assemblies.OrderBy(a => a.FullName).ToArray(); return rv.Distinct().ToArray();
} }
} }
} }

10
src/Avalonia.DotNetCoreRuntime/project.json

@ -2,14 +2,10 @@
"supports": {}, "supports": {},
"dependencies": { "dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1", "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.6.1" "NETStandard.Library": "1.6.0",
"System.Threading.ThreadPool": "4.3.0"
}, },
"frameworks": { "frameworks": {
"netstandard1.6": { "netstandard1.5": {}
"dependencies": {
"System.Threading.ThreadPool": "4.3.0",
"Microsoft.Extensions.DependencyModel": "1.1.0"
}
}
} }
} }
Loading…
Cancel
Save