I'm using Ninject (v3.2.2.0) with a tool built on a .net 3.5 framework. This had been fine - up until a couple of weeks ago when I put aside development.
I've picked it up again to prepare for the release, and it is no longer fine - it still compiles without issue, but I now get a FileNotFoundException whenever I try to run the it:
System.IO.FileNotFoundException occurred Message=Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified. Source=Ninject FileName=System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e FusionLog=Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll Running under executable E:\work\wire\M\Tools\Import\bin\Debug\Import.vshost.exe --- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = ZOO\TAL LOG: DisplayName = System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e (Fully-specified) LOG: Appbase = file:///E:/work/wire/M/Tools/Import/bin/Debug/ LOG: Initial PrivatePath = NULL Calling assembly : Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7.
LOG: This bind starts in default load context. LOG: Using application configuration file: E:\work\wire\MR\Tools\Import\bin\Debug\Import.vshost.exe.Config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config. LOG: Post-policy reference: System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e LOG: Attempting download of new URL file:///E:/work/wire/M/Tools/Import/bin/Debug/System.Core.DLL. LOG: Attempting download of new URL file:///E:/work/wire/M/Tools/Import/bin/Debug/System.Core/System.Core.DLL. LOG: Attempting download of new URL file:///E:/work/wire/M/Tools/Import/bin/Debug/System.Core.EXE. LOG: Attempting download of new URL file:///E:/work/wire/M/Tools/Import/bin/Debug/System.Core/System.Core.EXE.
StackTrace: at Ninject.Planning.Bindings.BindingConfiguration..ctor() at Ninject.Planning.Bindings.Binding..ctor(Type service) at Ninject.Syntax.BindingRoot.BindT at Ninject.KernelBase..ctor(IComponentContainer components, INinjectSettings settings, INinjectModule[] modules) at Ninject.StandardKernel..ctor(INinjectModule[] modules) at Import.ImportBootstrapper.Import(String[] xiArgs) in e:\work\wire\M\Tools\Import\ImportBootstrapper.cs:line 16 InnerException:
I've taken this to its extreme - I'm currently trying to run only the following code:
using Ninject;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
new StandardKernel();
}
}
}
Which again, compiles just fine, but as soon as I get to new StandardKernal();
line it breaks with the same error as above.
It's also all in source control, so I've loaded this up on a colleague's system, references, libraries, configs and all, and yep, it runs fine on their machine.
To try and fix this, I have:
Made sure that the referenced System.Core file exists (it does).
Made sure that it has the correct permissions.
Ensured that System.Core definitely existed in GAC - it did, and the results are below:
C:\> gacutil -l | find /i "system.core" System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
In "Turn Windows features on or off", removed .NET Framework 3.5, rebooted, reinstalled .NET 3.5, rebooted again, tried to run the program.
Installed all available windows updates (initally the .NET ones, but eventually all of them).
Tried to find issues with
sfc /scannow
, to no effect.Tinkered with various supportedRuntime versions in the App.config file:
<configuration> <startup> <supportedRuntime version="v2.0.50727"/> <supportedRuntime version="v3.5.30729"/> </startup> </configuration>
(Having either, both, or neither makes no discernible difference)
Made sure that the Reference files definitely included System.Core (
<Reference Include="System.core" />
).Made sure that the project properties are definitely set to .Net 3.5.
I've also looked into the machine.config and web.config files. Nothing looked at fault, but I'm not sure I'd be able to identify if something was obviously wrong, so I can't say that this avenue of research is closed off.
I'm now completely at a loss. I mean, short of getting a new PC and starting from there.
What am I doing wrong?