Rider fails to publish using valid .pubxml from VS 2022

I have several valid .pubxml files that I have used for months to publish from Visual Studio 2022. I recently started working in Rider 2023.1 and have faced this error when attempting to publish:

 Microsoft.PackageDependencyResolution.targets(266, 5): [NETSDK1047] Assets file 'C:\Users\{redacted}\source\repos\{redacted}\{redacted}\obj\project.assets.json' doesn't have a target for 'net6.0/win-x64'. Ensure that restore has run and that you have included 'net6.0' in the TargetFrameworks for your project. You may also need to include 'win-x64' in your project's RuntimeIdentifiers.

The same occurs with .NET 7 projects. The suggested workaround of adding a runtime identifier to the .csproj fixes the issue:

<RuntimeIdentifier>win-x64</RuntimeIdentifier>
However, it seems odd to me that VS has no problem publishing, while Rider fails. Is this an issue with Rider, or something else?
1
3 comments
Hello, Thank you for contacting Rider support. We are sorry to hear that you have run into such a problem. Would you mind sharing the sample .pubxml file so that we could take a deeper look? Have a nice day!
0

Sure thing!

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <DeleteExistingFiles>true</DeleteExistingFiles>
    <ExcludeApp_Data>false</ExcludeApp_Data>
    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <PublishProvider>FileSystem</PublishProvider>
  <PublishUrl>\\redacted\server\path\</PublishUrl>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <SiteUrlToLaunchAfterPublish />
    <TargetFramework>net6.0</TargetFramework>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <ProjectGuid>69ca008f-c158-4646-b479-2f46ad542d14</ProjectGuid>
    <SelfContained>false</SelfContained>
  </PropertyGroup>
</Project>
0
Hello Rnielsen, Thank you for the file shared. I was able to reproduce this behavior. This is a known issue: Cannot publish solution previously created in VS: https://youtrack.jetbrains.com/issue/RIDER-93216; I updated the issue with your scenario. We would appreciate it if you could upvote this issue to bring additional awareness to it. While it is not fixed, the only options are: 1) To have RunIdentifier property set in csproj; 2) To publish via VS. Apologies for the inconvenience. Should you have any other questions or difficulties, please let me know. Have a nice day!
1

Please sign in to leave a comment.