We are building an Azure solution on Jenkins. This contains several F# projects, a Azure Cloud deployment project, and a C# Azure worker role.
On developer boxes it builds fine. When building on Jenkins we get:
"C:\Program Files (x86)\Jenkins\jobs\REDACTED.sln" (Clean;Build target) (1) ->
"C:\Program Files (x86)\Jenkins\jobs\REDACTED QA\workspace\REDACTED\REDACTED.csproj" (default target) (5:4) ->
"C:\Program Files (x86)\Jenkins\jobs\REDACTED QA\workspace\REDACTED.FSharp.AWS.S3\REDACTED.FSharp.AWS.S3.fsproj" (default target) (6:6) ->
(CoreCompile target) ->
FSC : error FS1052: Invalid value 'Qa' for '--targetprofile', valid values are 'mscorlib' or 'netcore'. [C:\Program Files (x86)\Jenkins\jobs\REDACTED QA\workspace\REDACTED.FSharp.AWS.S3\REDACTED.FSharp.AWS.S3.fsproj]
The problem seems to be something to do with an MSBuild parameter called 'TargetProfile' we need for the Azure aspects to specify which configuration to use (e.g. UAT or QA) and an undocumented F# parameter called --targetprofile which expects the values mscorlib or netcore.
We'd probably like a workaround which decouples these two usages of 'targetprofile'. Ideally we'd like not to have to fiddle with things like F#'s targets file as obviously we'd have to remember to apply this in all the places we might build now and in the future.
Blah, collision between MSBuild property names.
Maybe you can work around by defining a target in your project that runs directly before the F# compile target, and sets the F# TargetProfile to mscorlib, then also define a target that runs directly after F# compile that swaps the value back to whatever it was before.
From a quick test this seems to work ok.
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<!-- assume TP has Azure-specific value -->
<TargetProfile>QA</TargetProfile>
</PropertyGroup>
<Target Name="BeforeFSharpCompile" BeforeTargets="CoreCompile">
<PropertyGroup>
<TempTargetProfile>$(TargetProfile)</TempTargetProfile>
<TargetProfile>mscorlib</TargetProfile>
</PropertyGroup>
<Message Text="Swapped from $(TempTargetProfile) to $(TargetProfile)" />
</Target>
<Target Name="AfterFSharpCompile" AfterTargets="CoreCompile">
<PropertyGroup>
<TargetProfile>$(TempTargetProfile)</TargetProfile>
</PropertyGroup>
<Message Text="Swapped back to $(TargetProfile)" />
</Target>
</Project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With