0

Im currently struggling with some weird behaviour. i am using the on-premise version of TFS vNext Build 2015 (or how it is correctly called...)

I have to build a solution which consists of several projects defined as "x86". But there are also projects defined as "any cpu" in this particular solution.

I have set up the "visual studio build" step with Platform Parameter as "x86".

If i look in the log file (with debug true) of this build step, i see build arguments getting passed to msbuild like that

2018-02-02T07:47:01.2435083Z ##[debug]Entering Get-VSPath.
2018-02-02T07:47:01.2435083Z ##[debug] Version: '14.0'
2018-02-02T07:47:01.2591339Z ##[debug]Leaving Get-VSPath.
2018-02-02T07:47:01.2591339Z ##[debug]Leaving Select-VSVersion.
2018-02-02T07:47:01.2747595Z ##[debug]Entering Select-MSBuildLocation.
2018-02-02T07:47:01.2747595Z ##[debug] VSVersion: '14.0'
2018-02-02T07:47:01.2747595Z ##[debug] Architecture: 'x86'
2018-02-02T07:47:01.2903853Z ##[debug]Entering Get-MSBuildPath.
2018-02-02T07:47:01.2903853Z ##[debug] Version: '14.0'
2018-02-02T07:47:01.2903853Z ##[debug] Architecture: 'x86'
2018-02-02T07:47:01.3997646Z ##[debug]MSBuild: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
2018-02-02T07:47:01.3997646Z ##[debug]Leaving Get-MSBuildPath.
2018-02-02T07:47:01.4153898Z ##[debug]Leaving Select-MSBuildLocation.
2018-02-02T07:47:01.4153898Z ##[debug]Entering Format-MSBuildArguments.
2018-02-02T07:47:01.4153898Z ##[debug] MSBuildArguments: ''
2018-02-02T07:47:01.4153898Z ##[debug] Platform: 'x86'
2018-02-02T07:47:01.4153898Z ##[debug] Configuration: 'release'
2018-02-02T07:47:01.4153898Z ##[debug] VSVersion: '14.0'
2018-02-02T07:47:01.4153898Z ##[debug]Leaving Format-MSBuildArguments.
2018-02-02T07:47:01.4310157Z ##[debug]Entering Invoke-BuildTools.
2018-02-02T07:47:01.4466410Z ##[debug] NuGetRestore: 'True'
2018-02-02T07:47:01.4466410Z ##[debug] MSBuildLocation: 'C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe'
2018-02-02T07:47:01.4466410Z ##[debug] MSBuildArguments: ' /p:platform="x86" /p:configuration="release" /p:VisualStudioVersion="14.0"'

after looking at this i would say, everything is setup correctly, to get those projects defined as "x86" compiled for "x86" architecture. But neither the assembly is created in bin\x86\release nor the architecture is "x86" of the created dll. I checked this with a little powershell script, which i found here

How to determine if a .NET assembly was built for x86 or x64?

Any one has any idea what may i have to check, why it won't compile with "x86" architecture? Do i have to setup something differently, because the solution configuration manager is giving me "Mixed Platforms" if i have a look in the solution.

If any further information is needed, feel free to ask for.

thanks in advance for any suggestions or hints.

UPDATE 07.02.2018

For those having the same problem, for me the whole problem was only a missunderstanding in how it works with those platform settings. In my case, there was already an existing configuration for "x86" which has setup every project except the main project as "any cpu". My fault has been, that i had looked in VS in Configuration Manager and had chosen "mixed platforms". I should have chosen "x86" in VS like i did in the build step.

Dom84
  • 852
  • 7
  • 20
  • Which edition of TFS 2015 do you use? Is it TFS 2015.4? Do you check `bin\x86\release` on build agent machine? If you run your project locally in VS, are you able to see the assemblies in `bin\x86\release`? Please share entire log of "visual studio build" step here. – Cece Dong - MSFT Feb 05 '18 at 03:01
  • @CeceDong-MSFT The WebAccess tells me this version of TFS 2015 Version 14.102.25423.0 I will ask our admin and will add it here as soon as possible, which Servicepacks are installed. If i run the solution locally, i get the outputs of those x86 projects in "bin\x86\release". I will add the log in the question – Dom84 Feb 05 '18 at 07:25

2 Answers2

1

I've tested a project in TFS 2015.4 on my side, and got correct behavior. Share my steps here for your reference:

  1. Right click the solution in VS, select Configuration Manager, choose Release configuration and x86 platform. Then check in your solution to TFS.

enter image description here

  1. Create a build definition in TFS, add task Visual Studio Build, and specify the Platform and Configuration.

enter image description here

  1. Queue build. And check the build outputs on your build agent machine. They are all locating in folder C:\agent\_work\1\s\Project\UnitTestProject1\bin\x86\Release (you should have a similar path).

  2. Check with the powershell script you shared, the ProcessorArchitecture is correct.

enter image description here

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • May it be a difference, if the solution consists of a mixture of "x86" and "any cpu" platform releases? Thats the difference here between your sample and my build. – Dom84 Feb 05 '18 at 07:22
  • Are you able to share a screenshot of your `Configuration Manager`? I also have `Any cpu` platform selected, but still get correct result. – Cece Dong - MSFT Feb 05 '18 at 07:31
  • im sorry i didnt give any update so far. thanks for your time you spent in helping. Meanwhile (weekend has past :) ) there has come some knew ideas and I have to clearify some things first with co-workers, maybe it is possible to switch these projects to "any cpu". i will give update as soon as i have some new information. – Dom84 Feb 07 '18 at 11:00
  • found it, have a look at my update :) thx for your time anyways – Dom84 Feb 07 '18 at 13:35
0

For those having the same problem, for me the whole problem was only a missunderstanding in how it works with those platform settings.

In my case, there was already an existing configuration for "x86" which has setup every project except the main project as "any cpu". My fault has been, that i had looked in VS in Configuration Manager and had chosen "mixed platforms". I should have chosen "x86" in VS like i did in the build step.

Dom84
  • 852
  • 7
  • 20