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 = "System.Reactive", Version = SystemReactiveVersion },
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.1" },
new NuSpecDependency() { Id = "NETStandard.Library", TargetFramework = "netcoreapp1.0", Version = "1.6.0" },
new NuSpecDependency() { Id = "Microsoft.NETCore.Portable.Compatibility", TargetFramework = "netcoreapp1.0", Version = "1.0.1" }
},
Files = coreLibrariesNuSpecContent
@ -792,7 +791,7 @@ Task("Zip-Files")
});
Task("Create-NuGet-Packages")
//.IsDependentOn("Build")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
foreach(var nuspec in nuspecNuGetSettings)

40
src/Avalonia.DotNetCoreRuntime/NetCoreRuntimePlatform.cs

@ -5,8 +5,6 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.Extensions.DependencyModel;
namespace Avalonia.Shared.PlatformSupport
{
@ -14,31 +12,33 @@ namespace Avalonia.Shared.PlatformSupport
{
public Assembly[] GetLoadedAssemblies()
{
List<Assembly> assemblies = new List<Assembly>();
// Mostly copy-pasted from (MIT):
// https://github.com/StefH/System.AppDomain.Core/blob/0b35e676c2721aa367b96e62eb52c97ee0b43a70/src/System.AppDomain.NetCoreApp/AppDomain.cs
foreach (var assemblyName in DependencyContext.Default.GetRuntimeAssemblyNames(RuntimeEnvironment.GetRuntimeIdentifier()))
var rv = new List<Assembly>();
var entry = Assembly.GetEntryAssembly();
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
{
var assembly = Assembly.Load(assemblyName);
// just load all types and skip this assembly if one or more types cannot be resolved
assembly.DefinedTypes.ToArray();
assemblies.Add(assembly);
}
catch (Exception ex)
{
Debug.Write(ex.Message);
}
asm = Assembly.Load(queue.Dequeue());
}
catch (Exception e)
{
Debug.Write(e.ToString());
continue;
}
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": {},
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.6.1"
"NETStandard.Library": "1.6.0",
"System.Threading.ThreadPool": "4.3.0"
},
"frameworks": {
"netstandard1.6": {
"dependencies": {
"System.Threading.ThreadPool": "4.3.0",
"Microsoft.Extensions.DependencyModel": "1.1.0"
}
}
"netstandard1.5": {}
}
}
Loading…
Cancel
Save