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

RuntimeIdentifiers is not recognized by sdk in new-style csproj #414

Closed
yyjdelete opened this issue Nov 21, 2016 · 6 comments
Closed

RuntimeIdentifiers is not recognized by sdk in new-style csproj #414

yyjdelete opened this issue Nov 21, 2016 · 6 comments

Comments

@yyjdelete
Copy link

Tested with dotnet-dev-1.0.0-preview3-004056, and got the error msg.

***\.nuget\packages\microsoft.net.sdk\1.0.0-alpha-20161104-2\build\Microsoft.NET.RuntimeIdentifierInference.targets(45,5): error : RuntimeIdentifier must be set for .NETFramework executables. Consider RuntimeIdentifier=win7-x86 or RuntimeIdentifier=win7-x64. [***\src\x1\x1.csproj]

The build failed. Please fix the build errors and run again.

Replace the RuntimeIdentifiers to RuntimeIdentifier works, but according to the doc, RuntimeIdentifiers should also be an valid property.

The working old-style project.json

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },

  "dependencies": {
    //"Microsoft.Extensions.Logging.Console": "1.0.0"
  },

  "frameworks": {
    "net45": {

    },
    "netcoreapp1.0": {
      "imports": "dnxcore50",

      "dependencies": {
        "Microsoft.NETCore.App": {
          //"type": "platform",
          "version": "1.0.1"
        },
        "System.Text.Encoding.CodePages": "4.0.1"
      }
    }
  },
  "runtimes": {
    "win7-x64": {}
  }
}

upgrade to new-style with dotnet migrate.
The not working new-style .csproj

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
  
  <PropertyGroup>
    <TargetFrameworks>net45;netcoreapp1.0</TargetFrameworks>
    <DebugType>portable</DebugType>
    <AssemblyName>x1</AssemblyName>
    <OutputType>Exe</OutputType>
    <RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
    <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="**\*.cs" />
    <EmbeddedResource Include="**\*.resx" />
    <EmbeddedResource Include="compiler\resources\**\*" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Sdk">
      <Version>1.0.0-alpha-20161104-2</Version>
      <PrivateAssets>All</PrivateAssets>
    </PackageReference>
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
    <Reference Include="System" />
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
    <PackageReference Include="Microsoft.NETCore.App">
      <Version>1.0.1</Version>
    </PackageReference>
    <PackageReference Include="System.Text.Encoding.CodePages">
      <Version>4.0.1</Version>
    </PackageReference>
  </ItemGroup>

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
  </PropertyGroup>
  
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@dsplaisted
Copy link
Member

@piotrpMSFT for the migrate issue, @blackdwarf for the docs.

@nguerrera @eerhardt Should we support multiple runtime identifiers via a RuntimeIdentifiers property in the .NET SDK? If so, how would that interact if there are multiple target frameworks?

@nguerrera
Copy link
Contributor

Adding @emgarten for nuget perspective.

@blackdwarf
Copy link

@nguerrera so, for the docs, if there is one of X, we should use singular and if there are multiples of X we should use plural?

@emgarten
Copy link
Member

Restore supports both RuntimeIdentifier and RuntimeIdentifiers

how would that interact if there are multiple target frameworks?

For restore the RIDs are applied to all TFMs. Per TFM RIDs are not supported in restore, but it has been considered.

@srivatsn srivatsn added the Bug label Nov 29, 2016
@srivatsn srivatsn added this to the 1.0 RC3 milestone Nov 29, 2016
@srivatsn srivatsn modified the milestones: 1.0 RC3, 1.0 RTM Jan 13, 2017
@srivatsn
Copy link
Contributor

@nguerrera
Copy link
Contributor

Closing as duplicate of #396, the plan for which will fix this.

mmitche pushed a commit to mmitche/sdk that referenced this issue Jun 5, 2020
Add property to disable Web SDK implicit version logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants