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

Add runtimeconfig.json for .NET Core executables #120

Merged
merged 2 commits into from
Dec 23, 2019

Conversation

j3parker
Copy link
Member

This is half of #71. The other half is invoking the exe with dotnet rather than directly (I'm going to use the wrapper to do this, but in a follow-up PR).

@@ -27,5 +27,5 @@ csharp_nunit_test(
csharp_library(
name = "lib",
srcs = ["lib.cs"],
target_frameworks = ["net472"],
target_frameworks = ["netcoreapp3.0"],
Copy link
Member Author

Choose a reason for hiding this comment

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

This only works nicely if the TFMs match: if it were .NET standard the DLL would be in another folder.

I'm now thinking that for .NET Core, rather than wrapping with a customized assembly loader maybe we should just add more probing paths to the runtimeconfig.json. We'll still need a wrapper for .NET Framework I think (see #9 for more details).

So my goal is to change this library to netstandardx.y in the future.

@j3parker
Copy link
Member Author

Still not 100% working:

$ bazel run basic:hello
INFO: Analyzed target //basic:hello (21 packages loaded, 2285 targets configured).
INFO: Found 1 target...
Target //basic:hello up-to-date:
  bazel-bin/basic/bazelout/netcoreapp3.0/hello.exe
  bazel-bin/basic/bazelout/netcoreapp3.0/hello.ref.exe
  bazel-bin/basic/bazelout/netcoreapp3.0/hello.pdb
INFO: Elapsed time: 0.773s, Critical Path: 0.01s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
/bin/bash: /private/var/tmp/_bazel_jacob/5ce6d685aeab8cd41f37e1f62e684c76/execroot/__main__/bazel-out/darwin-fastbuild/bin/basic/bazelout/netcoreapp3.0/hello.exe: cannot execute binary file

But now we're half-way there:

$ dotnet /private/var/tmp/_bazel_jacob/5ce6d685aeab8cd41f37e1f62e684c76/execroot/__main__/bazel-out/darwin-fastbuild/bin/basic/bazelout/netcoreapp3.0/hello.exe
Hello, world!
Some numbers for you:
        1, 1, 3, 5, 13, 21, 55, 89, 233, 377

@j3parker j3parker force-pushed the dotnet-run branch 2 times, most recently from 7ba87b8 to e5b808e Compare December 19, 2019 22:27
@j3parker j3parker merged commit 1c9cae5 into Brightspace:master Dec 23, 2019
@j3parker j3parker deleted the dotnet-run branch December 23, 2019 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant