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

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

Open
hallipr opened this issue Aug 20, 2024 · 1 comment
Open

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

hallipr opened this issue Aug 20, 2024 · 1 comment

Comments

@hallipr
Copy link
Contributor

hallipr commented Aug 20, 2024

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
@hallipr hallipr changed the title Native assembly location in NuGet package causing dotnet build warning Native assembly in NuGet /lib folder causing dotnet build warning Aug 20, 2024
@hallipr
Copy link
Contributor Author

hallipr commented Sep 28, 2024

To be clear, I understand CUE4Parse ships with the native assembly, it's just not in the correct folder in the nuget package. Native assemblies should be in /runtimes/{rid}/native/ not /lib/

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

No branches or pull requests

1 participant