dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.21k stars 9.95k forks source link

Can't build ASP.NET Core project using net461 and x64 #1804

Closed georgiosd closed 6 years ago

georgiosd commented 7 years ago

All my projects are locked to x64 configuration (AnyCPU is deleted) because, well, it only runs on x64 and depends on x64 native binaries.

My ASP.NET core project is configured to use net461 as I need to the full .net framework in order to reference the Microsoft.WindowsAzure.ServiceBus nuget and to reference my class libraries.

project.json excerpt:

   "frameworks": {
    "net461": {} 
  },

  "runtimes": {
    "win7-x64": {},
    "win8-x64": {},
    "win10-x64": {}
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "platform": "x64"
  },

Building the project now gives me an error:

2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(724,5): error : The OutputPath property is not set for project 'BlackCat.Automation.Messaging.csproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='AnyCPU'.  This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.
2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(724,5): error : The OutputPath property is not set for project 'BlackCat.Core.csproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='AnyCPU'.  This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

I've tried manually changing the Any CPU => x64 in the sln file but it reverts back once you build the project.

Any ideas?

EDIT: Even after adding the AnyCPU configuration for the two projects referenced here, the project built successfully but while I tried to publish with win7-x64 runtime, it built the win10-x64 and couldn't find the output files. Switching to win10-x64 failed to start the app on Windows Server 2012 R2.

It seems to me that the whole .NET core ecosystem is very messy even at RC2 when it comes to supporting anything "non-standard" (limited to .NET Core apps). I would love to see an example project with this configuration: .NET Core APIs, to get advantage of all the goodies such as webpack etc but with reference to net461 - not all of us are interested in deploying to Linux right now...

troshko111 commented 7 years ago

Any updates? Issue still around, VS "fixes" the sln file and hardcodes Any CPU and then fails to build asp.net core project complaining one of its dependencies does not define Any CPU (of course it does not, it cannot in my case as the dependency is Service Fabric stateless service). Seriously frustrating experience considering such stateless services are officially recommended approach for out-of-cluster communication solution

troshko111 commented 7 years ago

Matt compiled a repro here

https://github.com/mattridgway/Service-Fabric-Error

adam3039 commented 7 years ago

I'm running into this issue as well. I'm using a shared PCL and need my ASP.NET Core service to be x64 & 4.6.1 for Azure Service Bus communication. If you set it to x64 in the configuration manager, it is automatically set back to Any CPU.

ishepherd commented 7 years ago

+1

KatteKwaad commented 7 years ago

We REALLY need a fix for this. This issue relates to my problem described here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/9b733a3b-2b65-416b-b2bd-15080b51f57b/referencing-project-does-not-build-using-the-same-or-an-equivalent-configuration-or-platform-error?forum=AzureServiceFabric

mattridgway commented 7 years ago

I've managed to get a version working by using VS2017, I'm going to update the repo https://github.com/mattridgway/Service-Fabric-Error to show it working. It looks like the VS2017 tooling has fixed this, although your class libraries holding the interfaces MUST target the full .NET framework.

kenneth-f-nielsen commented 7 years ago

I ran into the same issue, with vs 2015 sp3, with full .net 4.6 (don't support Azure though, but has anyone found a workaround? - or some fix from ms?

utilitydelta commented 7 years ago

+1. VS 2017. Create a new asp net core with .NET full framework. Project properties - change from x86 to x64. Web deploy publish to IIS. 502.5 error. Would be nice to work under x64! :)

dylanvdmerwe commented 7 years ago

Why can we not run under x64 or Any CPU?

vsDizzy commented 7 years ago

+1 New Project in VS2017. Change to x64. Debug - BadImageFormatException.

arisliang commented 7 years ago

I have problem with net452 and x64 as well. AnyCPU was fine, x64 causes problem.

vsDizzy commented 7 years ago

A workaround is to 'Unload a Project' and edit runtime version in your .csproj file manually.

  <PropertyGroup>
    <TargetFramework>net47</TargetFramework>
    <RuntimeIdentifier>win10-x64</RuntimeIdentifier>
  </PropertyGroup>

It is very straightforward and works like a charm.

Abdruggi commented 7 years ago

The problem is back with core 2.0... Setting RuntimeIdentifier does not help anymore...

aspnet-hello commented 6 years ago

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.