Skip to content

Commit

Permalink
[Sdk] Maybe better handling of assembly references
Browse files Browse the repository at this point in the history
  • Loading branch information
wannkunstbeikor committed Oct 28, 2023
1 parent c41c68d commit 9ced814
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
1 change: 1 addition & 0 deletions FrostySdk/FrostySdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Basic.Reference.Assemblies.Net70" Version="1.4.5" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
</ItemGroup>

Expand Down
15 changes: 4 additions & 11 deletions FrostySdk/Sdk/TypeSdkGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Linq;
using System.Reflection;
using System.Text;
using Basic.Reference.Assemblies;
using Frosty.Sdk.IO;
using Frosty.Sdk.Managers;
using FrostyTypeSdkGenerator;
Expand Down Expand Up @@ -76,9 +77,9 @@ public bool CreateSdk(string filePath)

sb.AppendLine("using System;");
sb.AppendLine("using System.Collections.ObjectModel;");
sb.AppendLine("using System.Reflection;");
sb.AppendLine("using Frosty.Sdk.Attributes;");
sb.AppendLine("using Frosty.Sdk.Managers;");
sb.AppendLine("using System.Reflection;");
sb.AppendLine("using Frosty.Sdk;");
sb.AppendLine();
sb.AppendLine("[assembly: SdkVersion(" + FileSystemManager.Head + ")]");
Expand Down Expand Up @@ -126,17 +127,9 @@ public bool CreateSdk(string filePath)
SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(source);

List<MetadataReference> references =
new() { MetadataReference.CreateFromFile(typeof(ObservableCollection<>).Assembly.Location) };
new() { MetadataReference.CreateFromFile(typeof(TypeLibrary).Assembly.Location) };

Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();

foreach (Assembly assembly in assemblies)
{
if (!assembly.IsDynamic && !string.IsNullOrEmpty(assembly.Location))
{
references.Add(MetadataReference.CreateFromFile(assembly.Location));
}
}
references.AddRange(Net70.References.All);


#if EBX_TYPE_SDK_DEBUG
Expand Down

0 comments on commit 9ced814

Please sign in to comment.