Skip to content

error NETSDK1094 when using PublishReadyToRun to publish a library #39141

Closed
@al0rid4l

Description

@al0rid4l

Describe the bug

I am trying to publish a library using <PublishReadyToRun>true</PublishReadyToRun> with <RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers> and got error

error NETSDK1094: Unable to optimize assemblies for performance: a valid runtime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing. When targeting .NET 6 or higher, make sure to restore packa
ges with the PublishReadyToRun property set to true.

To Reproduce

Here is the csproj file I'm using:

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>net8.0</TargetFramework>
		<OutputType>Library</OutputType>

		<!-- It's ok. -->
		<!-- <RuntimeIdentifier>win-x64</RuntimeIdentifier> -->
		<!-- It's ok. -->
		<!-- <RuntimeIdentifier>linux-x64</RuntimeIdentifier> -->
		<!-- error NETSDK1094 -->
		<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>

		<!-- R2R -->
		<PublishReadyToRun>true</PublishReadyToRun>
	</PropertyGroup>
</Project>

Exceptions

no errors.

System Info & Version

Windows 10 Pro N 22H2 19045.4046
.NET 8.0.101
Processor 13th Gen Intel(R) Core(TM) i5-13600KF 3.50 GHz

Also see

#14169 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions