-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update FSharp.Core reference in WebSharper.MSBuild #504
Comments
FSharp.Core 4.3.0.0 is included in the WebSharper NuGet package in the |
We have an equivalent problem and get the error message:
I've just started looking into it. This is running on the VSO build system, I have access to the agent so can collect additional logs if that'll help? |
In case it helps narrow the problem down it didn't happen with 3.5.3.203. We were upgrading to get the msbuild fix #486 which might be related. |
You're totally right, I didn't see that FSharp.Core 4.3.0.0 is in the same folder. But according to the assembly resolution rules the runtime doesn't search in this folder, does it? I get this error from MSBuild (I think it's slightly different than @cgravill 's): EDIT: I just saw it's basically the same, but I executed the
|
Based on comments to another issue #468 I've been able to workaround this by adding a binding redirect in MSBuild.exe.config so it targets 4.3.1.0. |
I digged a bit through the code in |
I think this doesn't work because it fails to load FSharp.Core to run WS.MSBuild itself, before it even reaches the point where we set up this new appdomain. Can you try the following:
<UsingTask TaskName="WebSharperHandleAssemblyResolve" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<SearchPath ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Reflection" />
<Code Type="Fragment" Language="cs">
<![CDATA[
AppDomain.CurrentDomain.AssemblyResolve += (sender, e) =>
{
var n = e.Name.Split(',')[0];
if (n == "FSharp.Core") {
return Assembly.LoadFrom(Path.Combine(SearchPath, n) + ".dll");
}
else return null;
};
]]>
</Code>
</Task>
</UsingTask>
<Target Name="BeforeBeforeBuild" BeforeTargets="BeforeBuild">
<WebSharperHandleAssemblyResolve SearchPath="$(MSBuildThisFileDirectory)/../tools/net40" />
</Target> It's a bit of an extreme measure, but it should load the FSharp.Core.dll 4.3.0.0 located in the nuget package. |
Of course, stupid me, FSharp.Core is needed immediately. I tried adding the
With this I got the following output:
According to the stack trace it looks as if FSharp.Core is loaded when creating the |
Yes it would seem that FSharp.Core is already loaded before we even start to run the task. I have updated intellifactory/ClientServer.Azure to 3.6 on the develop branch, and I can reproduce this issue with it, so I keep investigating. |
I think in my case the problem is that EDIT: |
Yes, I am actually finding out that I was wrong about the issue being when first loading ws.msbuild, and it is actually when loading the appdomain. I have a fix that is working for me committed on this branch. Can you copy this file to your application's |
Works for me too, thanks for the fast fix. Can you explain what this does and why using the WebSharper40.exe.config file for the new |
The .config file tells the app domain that when loading FSharp.Core 4.3 it should look for 4.4 instead, but it doesn't say anything about where 4.4 is located. That's what I added in my fix, I force it to load FSharp.Core.dll from the location that is used by the project. |
I see, thanks for the explanation. However, I think it doesn't work with all msbuild targets. At least |
Indeed, fixing this. |
Thanks. I didn't try it, but it won't be able to load the correct |
It won't, but it doesn't need to. The reason we need a specific FSharp.Core is so that we can reference the user's assemblies and work on their metadata; but when doing a Clean we don't need to do that, we just delete files. |
Ahh I see, thanks. |
@Tarmil, I just updated to 3.6.6.225 and the |
@Tarmil push |
I spun up another clean build agent, with a later version of WebSharper (3.6.7.227) and appear to have the same problem: packages\WebSharper.3.6.7.227\build\WebSharper.targets (60, 5) I can deploy my fix again but it would be great not to have to tweak build agents. |
As of WebSharper 3.6.2.220
WebSharper.MSBuild
references FSharp.Core 4.3.0.0. Since this version of FSharp.Core seems to be unavailable for an Azure WebJob and I'm not sure how to add binding redirects for MSBuild.exe WebSharper won't be able to build my website in Azure.The only way I see to fix this is referencing a newer version of FSharp.Core. Any thoughts?
The text was updated successfully, but these errors were encountered: