diff --git a/dotnet/private/nuget_pack.bzl b/dotnet/private/nuget_pack.bzl index 6fc2e10a00c1c..8ef0539ab7249 100644 --- a/dotnet/private/nuget_pack.bzl +++ b/dotnet/private/nuget_pack.bzl @@ -13,16 +13,7 @@ def _guess_dotnet_version(label, assembly_info): # The dirname will be something like `bazel-out/darwin_arm64-fastbuild-ST-5c013bc87029/bin/dotnet/src/webdriver/bazelout/net5.0` # Note that the last segment of the path is the framework we're # targeting. Happy days! - full_path = assembly_info.libs[0].dirname - - # And that framework is after the constant string `bazelout` - index = full_path.index(label.name) - - # The actual start is at the _end_ of the `bazelout` string - index += len(label.name) - - to_return = full_path[index:].replace("/", "") - return to_return.replace("/", "") + return assembly_info.libs[0].dirname.split("/")[::-1][0] def nuget_pack_impl(ctx): nuspec = ctx.actions.declare_file("%s-generated.nuspec" % ctx.label.name)