Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling using csproj small fix #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Neo.Compiler.MSIL/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private static MetadataReference[] CreateReferences(params string[] references)
MetadataReference.CreateFromFile(Path.Combine(coreDir, "System.Runtime.Numerics.dll")),
MetadataReference.CreateFromFile(typeof(System.ComponentModel.DisplayNameAttribute).Assembly.Location),
MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
MetadataReference.CreateFromFile(typeof(Neo.SmartContract.Framework.SmartContract).Assembly.Location),
});
refs.AddRange(references.Select(u => MetadataReference.CreateFromFile(u)));
return refs.ToArray();
Expand Down
3 changes: 3 additions & 0 deletions src/Neo.Compiler.MSIL/Neo.Compiler.MSIL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@
<PackageReference Include="Neo" Version="3.0.0-CI00191" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Neo.SmartContract.Framework\Neo.SmartContract.Framework.csproj" />
</ItemGroup>
</Project>
12 changes: 10 additions & 2 deletions src/Neo.Compiler.MSIL/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ private static void Run(CmdOptions args)
log.Log("Neo.Compiler.MSIL console app v" + Assembly.GetEntryAssembly().GetName().Version);

// Set current directory
var path = Path.GetDirectoryName(args.Filename);
var fileInfo = new FileInfo(args.Filename);
if (!fileInfo.Exists)
{
log.Log("Could not find file " + args.Filename);
Environment.Exit(-1);
return;
}

var path = fileInfo.Directory.FullName;
if (!string.IsNullOrEmpty(path))
{
try
Expand Down Expand Up @@ -101,7 +109,7 @@ private static void Run(CmdOptions args)
.Select(u => u.Attribute("Update").Value)
.ToList();

files.AddRange(Directory.GetFiles(Path.GetDirectoryName(args.Filename), "*.cs", SearchOption.AllDirectories));
files.AddRange(Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing bugs in my pc

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which bug?

files = files.Distinct().ToList();

log.Log("Compiling from csproj source");
Expand Down