Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"AnyCPU" vs "Any CPU" in TFS 2010

Tags:

tfs

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?

like image 320
R4cOOn Avatar asked Jun 02 '10 12:06

R4cOOn


3 Answers

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.

like image 128
Dawid Potgieter Avatar answered Nov 10 '22 12:11

Dawid Potgieter


(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.

like image 10
Mike Gledhill Avatar answered Nov 10 '22 11:11

Mike Gledhill


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.

like image 4
Jim Lamb Avatar answered Nov 10 '22 10:11

Jim Lamb