Forum Visual Studio

MSBuild of csproj defaults to Debug|AnyCPU regardless of what platform/config is specified

I have a Windows server running Jenkins where I'm building Android and iOS applications (mac agent). I prefer to build the csproj as we only have one solution file for both platforms.

I'm using the latest Visual Studio 2017 along with the most up-to-date msbuild.

What I'm seeing is that when I specify configuration and platform at the command line, it's not actually using the configuration defined in the csproj file, nor does it throw any sort of error whether the configuration is correct or not. It simply uses the Default configuration regardless of what I tell it to use.

Here is what my build looks like for iOS:
msbuild name.of.csproj /p:Configuration=Debug /p:Platform=iPhone /p:ServerAddress=x.y.z /p:ServerUser=user /p:ServerPassword=pass

Within the name.of.csproj file there is a configuration specified for Debug | iPhone complete with various settings like OutputPath, BuildIpa, etc.

What I'm seeing is that it defaults to the default Debug|AnyCPU regardless of what config/platform I want. Even trying Release it still uses Debug/AnyCPU.

I'm able to successfully build and deploy an IPA to an iPhone when I specify all of the extra parameters in the command line.

Why doesn't the command pick up the correct configuration? I used to build this way with vs2015 with a previous app and it worked.

Anyone have any idea as to why it wouldn't pick up the correct configuration in the csproj when I specify it in msbuild?


  • I realized I posted this in the Mac Tools forum, my bad. I thought I had clicked the Windows one.

    I found a weird work-around to my problem by building against the solution file but then specifying a target against the project.

    First I ran this in the command line:
    SET MSBuildEmitSolution=1

    Then I build the solution without any parameters which generates a sln.metaproj file that you can dig through to find targets for your project, which replace periods with underscores.

    So I now do:
    msbuild my.sln /t:"name_of_my_proj:Rebuild" /p:Configuration=Debug /p:Platform=iPhone

    This builds the project and uses the actual properties set for the configuration/platform.

Sign In or Register to comment.