Core: Failed to build self-contained asp.net core app for win8-x64 target

Created on 27 Mar 2017  路  5Comments  路  Source: dotnet/core

Hi!
I have successfully built (but didn't try to run yet) my app for ubuntu using
dotnet publish -c Release -r ubuntu.16.04-x64
But when i try
dotnet publish -c Release -r win8-x64
it produces this error:

E:\Program Files\dotnet\sdk\1.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Assets file '\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v1.1/win8-x64'. Ensure you have restored this project for TargetFramework='netcoreapp1.1' and RuntimeIdentifier='win8-x64'.

My .csproj contains this:

<PropertyGroup>
  <OutputType>Exe</OutputType>
  <TargetFramework>netcoreapp1.1</TargetFramework>
  <PreserveCompilationContext>true</PreserveCompilationContext>
  <RuntimeIdentifiers>win7-x64;win7-x86;win8-x64;ubuntu.16.04-x64;</RuntimeIdentifiers>
  <SuppressDockerTargets>True</SuppressDockerTargets>
</PropertyGroup>

Most helpful comment

One idea, I think I've seen scenarios where VS/VSCode and the command line fight with eachother on this. Could that be the case here? Do you have the project open in VS or VS Code? If so, can you try closing them, then run dotnet restore -r win8-x64. This should create the right project.assets.json and then you should be able to publish. If this isn't what is going on, someone will have to take a closer look.

All 5 comments

@ericstj , any idea? Are win7-x64 and win8-x64 conflicting here?

One idea, I think I've seen scenarios where VS/VSCode and the command line fight with eachother on this. Could that be the case here? Do you have the project open in VS or VS Code? If so, can you try closing them, then run dotnet restore -r win8-x64. This should create the right project.assets.json and then you should be able to publish. If this isn't what is going on, someone will have to take a closer look.

"restore" helped, the application works.
Thank you

@Petermarcu "I think I've seen scenarios where VS/VSCode and the command line fight with eachother on this" was correct for me, closing VS 2017 helped. Hope it will be resolved.

I believe that is being addressed in the upcoming tooling releases.

Was this page helpful?
0 / 5 - 0 ratings