Skip to content

Building .NET Framework libraries fails: error CS0006: Metadata file 'System.EnterpriseServices.Wrapper.dll' could not be found #477

Open
@sin-ack

Description

@sin-ack

This error seems to happen because of the fix done to solve #405:

# See https://github.com/bazel-contrib/rules_dotnet/issues/405
if not file.endswith(".dll") or file.endswith(".resources.dll") or file.endswith("System.EnterpriseServices.Thunk.dll") or file.endswith("System.EnterpriseServices.Wrapper.dll"):
return

This causes the following problem:

error CS0006: Metadata file '/tmp/bazel-working-directory/_main/external/_main~targeting_packs_extension~nuget.microsoft.netframework.referenceassemblies.net48.v1.0.3/build/.NETFramework/v4.8/System.EnterpriseServices.Wrapper.dll' could not be found

However, naively removing this check fails with:

error CS1509: The referenced file '/tmp/bazel-working-directory/_main/external/_main~targeting_packs_extension~nuget.microsoft.netframework.referenceassemblies.net48.v1.0.3/build/.NETFramework/v4.8/System.EnterpriseServices.Wrapper.dll' is not an assembly

This is because System.EnterpriseServices.Wrapper.dll is not an assembly, but a "module", which is a collection of IL code without an assembly manifest (why this is even a thing is an exercise for the reader). It appears that we need another kind of entry beyond "lib" and "ref" called "module", and this library should be added with -addmodule:.

See: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/inputs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions