1
votes

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
do you have a sample repo that show this error? I tried to add that TypeProvider into a project of mine, and it built fine on git deployment. Also what runtime are you targeting and do you have any other packages in your packages.config?ahmelsayed
github.com/Overlord-Zurg/AzureTypeProviderSample. I'm targetting F# 3.1, .NET 4.5.1, and it's a WebSharper "Client-Server Web Application".Overlord Zurg
huh, I just created a brand new site, and git pushed that repo to the site, and it deployed successfully. do you have anything custom on your site?ahmelsayed
though, you have a version of the FSharp runtime checked into the repo it shouldn't affect anything, but you may wanna consider a .gitignore file that looks like thisahmelsayed
I just created a project of type "F# MVC 5" from the online templates and installed the Type Provider package, and it gave the same error. I did the same as you -- brand new "Web App", no settings changed. I'll try the .gitignore thing.Overlord Zurg

2 Answers

1
votes

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
votes

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/