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

NativeLibrary sample issue #589

Closed
KU348-code opened this issue Jan 26, 2021 · 3 comments
Closed

NativeLibrary sample issue #589

KU348-code opened this issue Jan 26, 2021 · 3 comments
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation

Comments

@KU348-code
Copy link

I downloaded the NativeLibrary sample project from Github and tried publishing it without any modifications but failed. The command used and the error (NETSDK1102) resulting from it are as follows. Visual studio pro version 16.8.4 and Microsoft.DotNet.ILCompiler version 6.0.0-preview.1.21075.1 was used for publishing. Please advice.

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts>dotnet publish /p:NativeLib=Shared -r win-x64 -c release "C:\NativeLibrary\NativeLibrary.csproj"
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore...
Restored C:\NativeLibrary\NativeLibrary.csproj (in 2.15 sec).
NativeLibrary -> C:\NativeLibrary\bin\release\net5.0\win-x64\NativeLibrary.dll
C:\Program Files\dotnet\sdk\5.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(143,5): error NETSDK1102: Optimizing assemblies for size is not supported for the selected publish configuration. Please ensure that you are publishing a self-contained app. [C:\NativeLibrary\NativeLibrary.csproj]

@jkotas jkotas added the area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation label Jan 26, 2021
@jkotas
Copy link
Member

jkotas commented Jan 26, 2021

cc @MichalStrehovsky

In the meantime, you can workaround this by setting /p:SelfContained=true on the dotnet publish command line.

@KU348-code
Copy link
Author

Many thanks jkotas. This workaround is sufficient for now.

@jkotas
Copy link
Member

jkotas commented Jan 29, 2021

We have documented the workaround. It is not easy to fix this in better way for now unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation
Projects
None yet
Development

No branches or pull requests

2 participants