Skip to content

Commit

Permalink
Fix compiler not aliasing Oxide.References
Browse files Browse the repository at this point in the history
  • Loading branch information
austinv900 committed Apr 27, 2024
1 parent f33d714 commit f272d30
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/CSharp/CSharpLanguage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,31 @@ private async Task<CompilerMessage> SafeCompile(CompilerData data, CompilerMessa
case ".cs":
case ".exe":
case ".dll":
references[fileName] = File.Exists(reference.Name) && (reference.Data == null || reference.Data.Length == 0) ? MetadataReference.CreateFromFile(reference.Name) : MetadataReference.CreateFromImage(reference.Data, filePath: reference.Name);
MetadataReference _ref;
if (File.Exists(reference.Name) && (reference.Data == null || reference.Data.Length == 0))
{
if (reference.Name.EndsWith("Oxide.References.dll"))
{
_ref = MetadataReference.CreateFromFile(reference.Name, new MetadataReferenceProperties(aliases: ImmutableArray.Create("References")));
}
else
{
_ref = MetadataReference.CreateFromFile(reference.Name);
}
}
else
{
if (reference.Name.EndsWith("Oxide.References.dll"))
{
_ref = MetadataReference.CreateFromImage(reference.Data, filePath: reference.Name, properties: new MetadataReferenceProperties(aliases: ImmutableArray.Create("References")));
}
else
{
_ref = MetadataReference.CreateFromImage(reference.Data, filePath: reference.Name);
}
}

references[fileName] = _ref;
continue;

default:
Expand Down

0 comments on commit f272d30

Please sign in to comment.