31

I spent a great many hours trying to work out why my project builds with the default (blank) configuration on TFS2010 but tells me there's no output path if I set it to anything.

In the end, I realised that in the .csproj file the configuration is written as AnyCPU while for TFS the proposed drop-down value is Any CPU (notice the space).

I removed the space in the TFS configuration and it worked.

The project was converted from a VS2008 version. Did MS change the name of the configuration for the VS2010 version? Can someone tell me what's happening?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
R4cOOn
  • 2,340
  • 2
  • 30
  • 41
  • This issue has big impact on TFS Build. Read more here: http://stackoverflow.com/questions/3156278/need-some-help-with-tfs2010-an-automated-build-configurations-to-build-de/7840115#7840115. – Manders Oct 20 '11 at 18:02
  • 1
    Just to add - It is Apr 2018 and I am using VS 2017 and I troubleshoot for a while trying to see why the output path had issues only to realize the ANY CPU vs ANYCPU issue. Now in VSTS I use two variables for buildplatform to build a sln and a csproj. – user2729765 Apr 17 '18 at 10:48

3 Answers3

20

This seems to be a known bug in VS2010.
See http://connect.microsoft.com/VisualStudio/feedback/details/503935/msbuild-inconsistent-platform-for-any-cpu-between-solution-and-project for more details.

What I've found :

All project files in a solution have the platform set to "AnyCPU" even though you select "Any CPU" in the configuration window. So if you build this solution in VS, everything works fine. When you try to build using the TFS "Any CPU" platform, solutions work fine, but projects have to be set (on the msbuild task) to use /p:AnyCPU.

Dawid Potgieter
  • 201
  • 2
  • 2
  • 1
    I had this same issue with TeamCity, but renaming to remove the space resolved it. I'm sure most build servers will run into this problem, unfortunately. – Bobson May 29 '15 at 20:39
  • https://connect.microsoft.com/VisualStudio/feedback/details/932918/solution-and-project-have-different-values-for-any-cpu# – Paul Totzke Apr 28 '16 at 19:08
  • The connect link is broken. – rory.ap Mar 04 '19 at 20:46
10

(Four years later..)

This bug seems to be alive and kicking in Visual Studio 2012 aswell.

Today, I've been unable to deploy a new version of my Services project, as VS2012 kept telling me that I hadn't specified an OutputPath... yet I had, and could see it in my project's Properties window.

I also tried deploying my services to a local drive on my laptop, just to see if VS would do that.

But, no. It wouldn't.

Ouch

My config was actually called "Release (PreProd)" (without the speechmarks) but VS seems to have developed a stutter when trying to put this name into a path.

Restarting Visual Studio 2012 had no effect, and (after Googling for a solution), I checked that I didn't have a "Platform" environment variable on my machine, which might've messed things up for the compilers.

The ridiculous solution was to open up my solution file (.sln) in a text editor, then do a search'n'replace from "Any CPU" to "AnyCPU".

Obvious, really...!

January 2015

Just to add, this bug is still alive and kicking.

The simplest fix is actually to rename your configurations so they don't contain spaces or speechmarks (i.e. the default names !!)

So, by renaming a configuration from Release (Prod) to ReleaseProd, the bug goes away.

Mike Gledhill
  • 27,846
  • 7
  • 149
  • 159
  • 5
    Still alive in Visual Studio 2013 as well :( – Chris Simmons May 19 '14 at 15:17
  • 3
    July 2016 still alive in VS2015 :D – Lanka Jul 25 '16 at 08:33
  • The [care](http://www.google.com/search?q=all+i+wanna+say+is+that+they+dont+really+care+about+us) – zahir Nov 10 '16 at 22:12
  • VS 2017 v15.9.4, I saw "The OutputPath property is not set for project" in my build output and search results led me here. This: `msil` (in Microsoft.Common.CurrentVersion.targets) makes me think MS has attempted to deal with the issue (or least parts of it). Note: with diagnostic level logging I'm seeing this message as msbuild prepares for this potential error - but I'm not actually getting this error, just REALLY verbose output). – unbob Dec 27 '18 at 19:18
4

I'm not sure if it was every "AnyCPU" (no space), but the default target name is "Any CPU" with a space. I should point out, however, that these names are arbitrary strings and you can set them to whatever you like so long as they're consistent.

Jim Lamb
  • 25,355
  • 6
  • 42
  • 48