Skip to content

Native assembly in NuGet /lib folder causing dotnet build warning #156

Description

@hallipr

This appears to be cuased by a native assembly being in the /lib folder of the CUE4Parse 1.1.1 Nuget package.

see https://learn.microsoft.com/en-us/nuget/create-packages/native-files-in-net-packages#compile-assets
and https://stackoverflow.com/a/48123691/596349

Repro steps:

In an empty folder, when I

dotnet new classlib && dotnet build

I get

The template "Class Library" was created successfully.

Processing post-creation actions...
Restoring D:\repos\test\test.csproj:
  Determining projects to restore...
  Restored D:\repos\test\test.csproj (in 62 ms).
Restore succeeded.


  Determining projects to restore...
  All projects are up-to-date for restore.
  test -> D:\repos\test\bin\Debug\net8.0\test.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.90

when I:

dotnet add package CUE4Parse && dotnet build

I get:

  Determining projects to restore...
  
...

info : Package 'CUE4Parse' is compatible with all the specified frameworks in project 'D:\repos\test\test.csproj'.
info : PackageReference for package 'CUE4Parse' version '1.1.1' added to file 'D:\repos\test\test.csproj'.
info : Writing assets file to disk. Path: D:\repos\test\obj\project.assets.json
log  : Restored D:\repos\test\test.csproj (in 344 ms).
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\8.0.304\Microsoft.Common.CurrentVersion.targets(2401,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. PE i
mage does not have metadata. PE image does not have metadata. [D:\repos\test\test.csproj]
  test -> D:\repos\test\bin\Debug\net8.0\test.dll

Build succeeded.

C:\Program Files\dotnet\sdk\8.0.304\Microsoft.Common.CurrentVersion.targets(2401,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. PE i 
mage does not have metadata. PE image does not have metadata. [D:\repos\test\test.csproj]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.03

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions