Skip to content

Commit 2ebfb55

Browse files
committed
Remove duplicate neo reference in Compiler
1 parent 8a7da63 commit 2ebfb55

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<PropertyGroup>
44
<AssemblyTitle>Neo.Compiler.CSharp</AssemblyTitle>
5-
<AssemblyName>nccs</AssemblyName>
5+
<TargetFramework>net7.0</TargetFramework>
6+
<AssemblyName>nccs</AssemblyName>
67
<OutputType>Exe</OutputType>
78
<PackageId>Neo.Compiler.CSharp</PackageId>
89
<PackAsTool>true</PackAsTool>
@@ -19,7 +20,6 @@
1920
<ItemGroup>
2021
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
2122
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
22-
<PackageReference Include="Neo" Version="3.6.2" />
2323
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1" />
2424
</ItemGroup>
2525

src/Neo.Compiler.CSharp/Program.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ private static int ProcessOutputs(Options options, string folder, CompilationCon
199199
{
200200
// Try to compile the artifacts into a dll
201201

202-
string coreDir = Path.GetDirectoryName(typeof(object).Assembly.Location)!;
203-
204-
var syntaxTree = CSharpSyntaxTree.ParseText(artifact);
202+
var coreDir = Path.GetDirectoryName(typeof(object).Assembly.Location)!;
205203
var references = new MetadataReference[]
206204
{
207205
MetadataReference.CreateFromFile(Path.Combine(coreDir, "System.Runtime.dll")),
@@ -210,16 +208,18 @@ private static int ProcessOutputs(Options options, string folder, CompilationCon
210208
MetadataReference.CreateFromFile(typeof(DisplayNameAttribute).Assembly.Location),
211209
MetadataReference.CreateFromFile(typeof(System.Numerics.BigInteger).Assembly.Location),
212210
MetadataReference.CreateFromFile(typeof(NeoSystem).Assembly.Location),
213-
MetadataReference.CreateFromFile(typeof(SmartContract.Testing.SmartContract).Assembly.Location)
211+
MetadataReference.CreateFromFile(typeof(SmartContract.Testing.TestEngine).Assembly.Location)
214212
};
215213

216-
var compilation = CSharpCompilation.Create(baseName, new[] { syntaxTree }, references,
217-
new CSharpCompilationOptions(
214+
CSharpCompilationOptions csOptions = new(
218215
OutputKind.DynamicallyLinkedLibrary,
219216
optimizationLevel: OptimizationLevel.Release,
220217
platform: Platform.AnyCpu,
221-
deterministic: true
222-
));
218+
nullableContextOptions: NullableContextOptions.Enable,
219+
deterministic: true);
220+
221+
var syntaxTree = CSharpSyntaxTree.ParseText(artifact, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Latest));
222+
var compilation = CSharpCompilation.Create(baseName, new[] { syntaxTree }, references, csOptions);
223223

224224
using var ms = new MemoryStream();
225225
EmitResult result = compilation.Emit(ms);

0 commit comments

Comments
 (0)