Reputation: 910
I know there are several similar topics on SO about this problem (believe me, I spent the last two days reading all of those), but none of them helped in my strange situation.
So I come here, maybe somebody can enlighten me what could be the problem.
We have a source of a C# (WPF) control, TreeListView.
It's compiled with VS2015 dev command prompt using csc.exe (part of bigger project, IDE is not used for compilation) with the following parameters:
/reference:"System.Xaml.dll"
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationCore.dll"
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsBase.dll"
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsFormsIntegration.dll"
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationFramework.dll"
/nowarn:1701,1702 /errorreport:prompt /warn:4 /platform:x86 /define:DEBUG;TRACE /debug+ /debug:full /optimize- /target:library /out:..\debug\TreeListView.dll
...here all the .cs source files are listed...
/resource:"..\TreeListView\obj\debug\TreeListView.g.resources"
All of our C#/WPF DLL is compiled with the same options in the command line.
It compiles fine, I have the TreeListView.dll. It is not strong named.
It is copied next to the mainApp.exe, and when I run the main app, and trying to use a window with this TreeListView, I got exception
*** Exception ***: System.IO.FileLoadException
Message: Could not load file or assembly 'TreeListView, PublicKeyToken=ffedd4b1334b06f5' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source: mscorlib
The main_app compiled also with csc.exe, referencing exactly the output of the above compiled TreeListView.dll
Btw, don't know why it displays public key, when it's not strong named
sn -T debug\TreeListView.dll
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
debug\TreeListView.dll does not represent a strongly named assembly
Other observation
In VS2015 IDE, I created a new WPF app, and referenced the above compiled TreeListView.dll - and used the control in the XAML: it immediately shows in the GUI XAML Designer that Could not load file or assembly 'TreeListView, PublicKeyToken=ffedd4b1334b06f5' or one of its dependencies. The system cannot find the file specified.
(note, here the error is The system cannot find the file specified.
)
I thougth IDE will give more information, but nothing new here.
Other info: This whole build/run process worked fine with VS2008 (.NET3.5), now after moving to VS2015 (.NET4), updaexperiencing this, and only with this TreeControl.dll
I checked all references of that dll, used framework, with ILSpy, ildasm, ProcessMonitor for file not found, etc but could not find anything useful.
ildasm > manifest of TreeControl.dll - this also looks ok to me
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern PresentationFramework
{
.publickeytoken = (31 BF 38 56 AD 36 4E 35 ) // 1.8V.6N5
.ver 4:0:0:0
}
.assembly extern System.Xaml
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern WindowsBase
{
.publickeytoken = (31 BF 38 56 AD 36 4E 35 ) // 1.8V.6N5
.ver 4:0:0:0
}
.assembly extern PresentationCore
{
.publickeytoken = (31 BF 38 56 AD 36 4E 35 ) // 1.8V.6N5
.ver 4:0:0:0
}
.assembly extern System
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern System.Core
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
Any idea what to check would be really appreciated.
Upvotes: 0
Views: 1429
Reputation: 84
Try using Fuslogvw for failed binding at the run-time. At the time when you are running the application set settings to 'Log binding failures to disk'.
Any failed bindings will be logged on the window. You can double click on the logs to get full details about which dll is trying to load TreeListView assembly and what all locations it is trying to look for that dll.
Upvotes: 1