Deploy F# Azure Storage type provider to deploy to Azure web app

165 views Asked by At

I'm trying to use the Azure Storage type provider in my F# project:

Install-Package FSharp.Azure.StorageTypeProvider

It works locally, but when I deploy from my local Git repository to my Azure web app, I get the following errors

remote: Updating branch 'master'.

remote: Updating submodules.

remote: Preparing deployment for commit id 'f67901b428'.

remote: Generating deployment script.

remote: Running deployment command...

remote: Handling .NET Web Application deployment.

remote: All packages listed in packages.config are already installed.

remote: All packages listed in packages.config are already installed.

remote: D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. [D:\home\site\repository\FlunSharp\FlunSharp.fsproj]

remote: FSC : error FS3031: The type provider 'D:\home\site\repository\packages\FSharp.Azure.StorageTypeProvider.1.2.0\lib\net40\FSharp.Azure.StorageTypeProvider.dll' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Azure.StorageTypeProvider' which cannot be loaded or doesn't exist. Could not load file or assembly 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. [D:\home\site\repository\FlunSharp\FlunSharp.fsproj]

remote: FSC : warning FS3005: Referenced assembly 'D:\home\site\repository\packages\FSharp.Azure.StorageTypeProvider.1.2.0\lib\net40\FSharp.Azure.StorageTypeProvider.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found [D:\home\site\repository\FlunSharp\FlunSharp.fsproj]

remote: Failed exitCode=1, command="D:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "D:\home\site\repository\FlunSharp\FlunSharp.fsproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\3ec76803-496c-41df-ad73-f8bc79256ad9";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="D:\home\site\repository.\"

remote: An error has occurred during web site deployment.

remote:

remote: Error - Changes committed to remote repository but deployment to website failed.

Any suggestions?

2

There are 2 answers

0
ahmelsayed On

We talked about this in the chat here

Basically this was an issue in how MSBuild on the server detects the right F# compiler to build the project with (3.0 vs 3.1)

A work around is to specify another MSBuild version through setting an app setting on the site that looks like this MSBUILD_PATH = D:\Program Files (x86)\MSBuild\12.0\Bin\amd64\MSBuild.exe

However, the right fix should go in the fsproj file. In particular this section

<!-- F# targets -->
<Choose>
    <When Condition="'$(VisualStudioVersion)' == '11.0'">
      <PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
          <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
      </PropertyGroup>
    </When>
    <Otherwise>
        <PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
            <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
        </PropertyGroup>
   </Otherwise>
</Choose>
<Import Project="$(FSharpTargetsPath)" />

Should be updated to

<!-- F# targets -->
<PropertyGroup>
    <VisualStudioVersion>12.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup>
    <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
<Import Project="$(FSharpTargetsPath)" />

I think this is an issue with WebSharper templates that don't set the correct visual studio version in the project file.

0
David Crook On

I would suspect you are hitting a similar issue to what I was hitting deploying F# to Azure. The issue I was running into is that the build system did not pick up the F# references correctly. I had to manually add the reference to the path, and manually move the .dll references into the output path of the final solution.

http://indiedevspot.com/2015/02/18/deploying-f-web-job-to-azure/