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

SelfContained projects need to set Runtime Identifier after .Net upgrade from 7.0.103 -> 7.0.200 #30894

Open
paulkram opened this issue Feb 27, 2023 · 0 comments
Assignees
Labels
untriaged Request triage from a team member

Comments

@paulkram
Copy link

Describe the bug

After updating my .Net SDK from 7.0.103 to 7.0.200 it complains:

Error NETSDK1191 A runtime identifier for the property 'SelfContained' couldn't be inferred. Specify a rid explicitly. C:\Program Files\dotnet\sdk\7.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets 190

I also verified it working with 7.0.102 and broken with 7.0.201.

We have a list of RuntimeIdentifiers set in the project, that's not sufficient!

To Reproduce

Example project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <LangVersion>latest</LangVersion>
    <IsPackable>false</IsPackable>
    <IsPublishable>false</IsPublishable>
    <StartupObject></StartupObject>
    <Platforms>AnyCPU</Platforms>
    <SelfContained>true</SelfContained>
    <RuntimeIdentifiers>win-x64;win-x86;osx-x64;osx.11.0-arm64;osx.12-arm64</RuntimeIdentifiers>
    <OutputType>WinExe</OutputType>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="Helpers\**" />
    <Compile Remove="UnitTests\**" />
    <EmbeddedResource Remove="Helpers\**" />
    <EmbeddedResource Remove="UnitTests\**" />
    <None Remove="Helpers\**" />
    <None Remove="UnitTests\**" />
  </ItemGroup>

  <ItemGroup>
	<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
	<PackageReference Include="Moq" Version="4.18.4" />
	<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
	<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
	<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>

</Project>

When setting

...
  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <LangVersion>latest</LangVersion>
    <IsPackable>false</IsPackable>
    <IsPublishable>false</IsPublishable>
    <StartupObject></StartupObject>
    <Platforms>AnyCPU</Platforms>
    <SelfContained>true</SelfContained>
    <RuntimeIdentifiers>win-x64;win-x86;osx-x64;osx.11.0-arm64;osx.12-arm64</RuntimeIdentifiers>
    **<RuntimeIdentifier>win-x64</RuntimeIdentifier>**
    <OutputType>WinExe</OutputType>
  </PropertyGroup>
...

it works. Unfortunately then other steps like

<ItemGroup>
    <None Update="SomeFolder\**">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

fail, because it's not copying to

bin\yourproject\buildconfig\net7.0

but to

bin\yourproject\buildconfig\net7.0\<<runtimeidentifier>>\

Then tests from MSTest ran in the normal bin\yourproject\buildconfig\net7.0 path and everything breaks.

Exceptions (if any)

  • none

Further technical details

  • Using Visual Studio 7.5.0 on Windows 11
@marcpopMSFT marcpopMSFT added the untriaged Request triage from a team member label Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants