locked
CSProj Choose and When Conditions Not Working RRS feed

  • Question

  • User200564 posted

    Hi

    Our solution is quite complex. We have our own packages via NuGet but also have the ability to refer directly to the source of those packages to decrease turnaround time for debugging of those packages. We give our developers this option via Build Configuration i.e. Debug-Source allows referencing to source while anything else uses the DLL's via NuGet. Problem is, this works fine on Windows, but Xamarin Studio on OS X doesn't like this. In fact, it acts like the references inside the block below do not exist. I've had a look around and can't find others raising this.

    Does Xamarin Studio support the , and flags within CSProj files? And if it does, what might I be missing that is causing it to not find the references that are defined within the CSProj?

    Note: I've changed some of the names below.

      <Choose>
        <When Condition="'$(Configuration)' == 'Debug-Source'">
          <ItemGroup>
            <ProjectReference Include="Source.csproj">
              <Project>{67B9D3A2-F71E-4428-913F-C37AE22CDB24}</Project>
              <Name>Sample</Name>
            </ProjectReference>
          </ItemGroup>
        </When>
        <Otherwise>
          <ItemGroup>
            <Reference Include="Normal, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
              <HintPath>..\packages\Normal\lib\portable-net45+netcore45+wp8+win8+monoandroid+monotouch+Xamarin.iOS\Normal.dll</HintPath>
            </Reference>
        </ItemGroup>
        </Otherwise>
      </Choose>
    
    Tuesday, April 18, 2017 12:59 PM

All replies

  • User31385 posted

    @DanielJGMaclean I haven't used those MSBuild elements, but I did find that the latest Xamarin Studio update (6.3) broke the Condition clause on iOS .csproj files. Prior to that it had been working (although it was already broken on Android projects).

    Thursday, April 20, 2017 10:41 PM