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

.NET8 AOT produces faulty win-x64 static library #95100

Closed
edward-a opened this issue Nov 22, 2023 · 2 comments · Fixed by #95106
Closed

.NET8 AOT produces faulty win-x64 static library #95100

edward-a opened this issue Nov 22, 2023 · 2 comments · Fixed by #95106

Comments

@edward-a
Copy link

Description

Win-x64 static library produced by .NET8 AOT fails to link when used in a Windows c++ console project. It results in error by cvtres.exe: ConsoleApplication1.res : fatal error LNK1241: resource file ClassLibrary1.lib(ClassLibrary1.obj) already specified.

Removing .rc file from the build solves the issue.

Reproduction Steps

  1. Create .NET8 C# class library project. Add trueStatic to the project file. Publish as win-x64.
  2. Create a C++ desktop console project. Switch to static c-runtime. Link against the published library, Bcrypt.lib and (....nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\8.0.0\sdk...)
    bootstrapperdll.obj
    Runtime.WorkstationGC.lib
    eventpipe-enabled.lib
    Runtime.VxsortEnabled.lib
    System.Globalization.Native.Aot.lib
    System.IO.Compression.Native.Aot.lib
  3. Build the app.

Expected behavior

Builds w/o issues

Actual behavior

ConsoleApplication1.res : fatal error LNK1241: resource file ClassLibrary1.lib(ClassLibrary1.obj) already specified.

Regression?

Was linking successfully in .NET7

Known Workarounds

Remove .rc from the build

Configuration

No response

Other information

No response

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 22, 2023
@ghost
Copy link

ghost commented Nov 22, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Win-x64 static library produced by .NET8 AOT fails to link when used in a Windows c++ console project. It results in error by cvtres.exe: ConsoleApplication1.res : fatal error LNK1241: resource file ClassLibrary1.lib(ClassLibrary1.obj) already specified.

Removing .rc file from the build solves the issue.

Reproduction Steps

  1. Create .NET8 C# class library project. Add trueStatic to the project file. Publish as win-x64.
  2. Create a C++ desktop console project. Switch to static c-runtime. Link against the published library, Bcrypt.lib and (....nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\8.0.0\sdk...)
    bootstrapperdll.obj
    Runtime.WorkstationGC.lib
    eventpipe-enabled.lib
    Runtime.VxsortEnabled.lib
    System.Globalization.Native.Aot.lib
    System.IO.Compression.Native.Aot.lib
  3. Build the app.

Expected behavior

Builds w/o issues

Actual behavior

ConsoleApplication1.res : fatal error LNK1241: resource file ClassLibrary1.lib(ClassLibrary1.obj) already specified.

Regression?

Was linking successfully in .NET7

Known Workarounds

Remove .rc from the build

Configuration

No response

Other information

No response

Author: edward-a
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@jkotas
Copy link
Member

jkotas commented Nov 22, 2023

Thank you for reporting this issue. You should be able to work around it by specifying <IlcGenerateWin32Resources>false</IlcGenerateWin32Resources> property in your .csproj file.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Nov 22, 2023
MichalStrehovsky added a commit to MichalStrehovsky/runtime that referenced this issue Nov 22, 2023
@ghost ghost removed in-pr There is an active PR which will close this issue when it is merged untriaged New issue has not been triaged by the area owner labels Nov 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants