title: .net version 6.0.300 Optimizing assemblies for performance is not supported for the selected target platform or architecture
body: <p>When migrating from .net 5 to .net 6 I run into similar issue as described here <a href="https://github.com/dotnet/sdk/issues/24269" rel="nofollow noreferrer">https://github.com/dotnet/sdk/issues/24269</a>, except in my case the build fails with NETSDK1095, instead of just printing warning. I pinned version to <code>6.0.201</code> with global.json. I was able to observe mentioned issue with version <code>6.0.300</code> on my local machine. With pinned version it went away. Assuming version <code>6.0.201</code> does not suffer mentioned regression.</p>
  <p>I added step to install custom SDK in to the azure pipeline. <br />
  Than <code>dotnet --version</code> command prints out <code>6.0.201</code></p>
  <p>Original pipeline looks like this</p>
  <ul>
  <li><code>dotnet restore</code></li>
  <li><code>dotnet build -c Release --no-restore</code></li>
  <li><code>dotnet test</code></li>
  <li><code>dotnet publish -c Release --no-build -r &quot;win10-x64&quot; -p:PublishReadyToRun=true</code></li>
  </ul>
  <p>And it is <code>PublishReadyToRun=true</code> which is causing an issue. When I added <code>--self-contained</code> it fixed it on <code>6.0.201</code> on localhost, but still fails in the pipe</p>
  <p>It fails with error:</p>
  <p><code>C:\hostedtoolcache\windows\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(293,5): error NETSDK1095: Optimizing assemblies for performance is not supported for the selected target platform or architecture. Please verify you are using a supported runtime identifier, or set the PublishReadyToRun property to false. </code></p>
  <p>I ran it on <code>windows-2019</code> and <code>windows-2022</code> azure agents.</p>
  <p>Anybody knows how to temporarily fix this issue?</p>