Skip to content
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

Mismatch FSharp.Core.dll WebSharper31.exe.config and msbuild #523

Closed
cgravill opened this issue Feb 5, 2016 · 4 comments
Closed

Mismatch FSharp.Core.dll WebSharper31.exe.config and msbuild #523

cgravill opened this issue Feb 5, 2016 · 4 comments
Labels

Comments

@cgravill
Copy link

cgravill commented Feb 5, 2016

Related to issue #504

There's a mismatch between the included version of FSharp.Core.dll (4.3.0.0) and what's configured in msbuild WebSharper31.exe.config which has:

  <dependentAssembly>
        <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
  </dependentAssembly>

When you run under msbuild e.g. automated builds you'll get failures like:

packages\WebSharper.3.6.7.227\build\WebSharper.targets (60, 5)
The "WebSharperTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

You could separate out WebSharper31.exe and WebSharper40.exe and ship a separate FSharp.Core.dll. As workaround I've substituted in the 4.3.1.0 dlls which works for me as a temporary fix.

@cgravill
Copy link
Author

cgravill commented Feb 5, 2016

You can see in more detail from the binding log what's going, that despite the error message being a lack of finding 4.3.0.0 it's the substituted 4.3.1.0 bind:

*** Assembly Binder Log Entry  (2/5/2016 @ 4:42:13 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/14.0/bin/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = msbuild.exe
Calling assembly : WebSharper.MSBuild, Version=3.6.0.0, Culture=neutral, PublicKeyToken=dcd983dec8f76a71.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\agent\_work\1\s\packages\WebSharper.3.6.7.227\tools\net40\WebSharper31.exe.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.3.0.0 redirected to 4.3.1.0.
LOG: Post-policy reference: FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/14.0/bin/FSharp.Core.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/14.0/bin/FSharp.Core/FSharp.Core.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/14.0/bin/FSharp.Core.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/14.0/bin/FSharp.Core/FSharp.Core.EXE.
LOG: Attempting download of new URL file:///C:/agent/_work/1/s/packages/WebSharper.3.6.7.227/tools/net40/FSharp.Core.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\agent\_work\1\s\packages\WebSharper.3.6.7.227\tools\net40\FSharp.Core.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
LOG: Attempting download of new URL file:///C:/agent/_work/1/s/packages/WebSharper.3.6.7.227/tools/net40/FSharp.Core/FSharp.Core.DLL.
LOG: Attempting download of new URL file:///C:/agent/_work/1/s/packages/WebSharper.3.6.7.227/tools/net40/FSharp.Core.EXE.
LOG: Attempting download of new URL file:///C:/agent/_work/1/s/packages/WebSharper.3.6.7.227/tools/net40/FSharp.Core/FSharp.Core.EXE.
LOG: All probing URLs attempted and failed.

@Tarmil Tarmil added the bug label Mar 18, 2016
@cgravill
Copy link
Author

We've also been seeing an equivalent issue when attempting a "Clean" under Visual Studio on projects that contain WebSharper -

1>------ Clean started: Project: XXXXXXXXXXXXXXX, Configuration: Release Any CPU ------
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: The "WebSharperTask" task failed unexpectedly.
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: File name: 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: 
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: Server stack trace: 
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.Metadata.RemotingTypeCachedData.GetSoapAttributeNoLock()
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.Metadata.RemotingCachedData.GetSoapAttribute()
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.InternalRemotingServices.GetCachedSoapAttribute(Object reflectionObject)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.SoapServices.GetXmlTypeForInteropType(Type type, String& xmlType, String& xmlTypeNamespace)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.RemotingServices.DetermineDefaultQualifiedTypeName(Type type)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, ConstructorCallMessage& ctorCallMsg)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Activator.CreateInstance(Type type, Boolean nonPublic)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at WebSharper.MSBuild.WebSharperTask.Execute()
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: 
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: Exception rethrown at [0]: 
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at Microsoft.Build.Framework.ITask.Execute()
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: 
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: WRN: Assembly binding logging is turned OFF.
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: Note: There is some performance penalty associated with assembly bind failure logging.
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
1>C:\XXXXXXXXXXXXXX\packages\WebSharper.3.6.7.227\build\WebSharper.targets(46,5): error MSB4018: 
2>------ Clean started: Project: XXXXXXXXXXXXXXXX, Configuration: Release Any CPU ------
3>------ Clean started: Project: XXXXXXXXXXXXXXXX, Configuration: Release Any CPU ------
4>------ Clean started: Project: XXXXXXXXXXXXXXXX, Configuration: Release Any CPU ------
========== Clean: 3 succeeded, 1 failed, 0 skipped ==========

I'm able to workaround this issue by altering the project from:<TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion> to <TargetFSharpCoreVersion>4.3.0.0</TargetFSharpCoreVersion>. So presumably there's also an attempt to redirect the binding there too.

@cgravill
Copy link
Author

Mainly for my own reference, to get F# 3.1 / 4.3.1.0 support, the steps you need are, edit (need administrator rights):

C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe.config

to include:

  <dependentAssembly>
        <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
  </dependentAssembly>

Then register the dll with gacutil (you may have to find an installer this):

gacutil /I "C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.1.0\FSharp.Core.dll"

@Tarmil
Copy link
Member

Tarmil commented Feb 25, 2019

Closing as outdated 3.x issue.

@Tarmil Tarmil closed this as completed Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants