Hi, your error message is completely different to the one reported in this
3 year old thread.
The compiler will usually give you that error when the referenced assembly
is actually marked as being compiled with a newer framework via the
TargetFrameworkAttribute.
I'd make sure you've got the assemblies you expect, I just checked Castle
Core 3.3.3 on nuget.org and .NET 4.0 and 4.5 have the right assemblies:
> [assembly: TargetFramework(".NETFramework,Version=v4.0,Profile=Client",
FrameworkDisplayName = ".NET Framework 4 Client Profile")]
> [assembly: TargetFramework(".NETFramework,Version=v4.5",
FrameworkDisplayName = ".NET Framework 4.5")]
Jono
On Tue, Nov 8, 2016 at 9:25 PM Ilya Petuhov <[email protected]> wrote:
> I've got the same kind of a problem, but with Casle.Core. Yet my solution
> doesn't compiles at all when calling (re)build solution, but still can be
> compiled one-by-one project.
> Here's the VS build output:
>
> 1>C:\Program Files
> (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5):
> warning MSB3275: The primary reference "C:\...\maxkpd.app.client.dll" could
> not be resolved because it has an indirect dependency on the assembly
> "Castle.Core, Version=3.3.0.0, Culture=neutral,
> PublicKeyToken=407dd0808d44fbdc" which was built against the
> ".NETFramework,Version=v4.5" framework. This is a higher version than the
> currently targeted framework ".NETFramework,Version=v4.0".
>
>
> So I switched back to Castle.Core 3.2.2. Maybe you should check the Core
> also?
>
> --
> Ilya Petukhov
>
> воскресенье, 6 октября 2013 г., 1:29:26 UTC+3 пользователь Krzysztof
> Koźmic написал:
>
> Obviously, Jono is right.
>
> While I verified that compiling in .net 4 mode emits different code than
> .net 4.5 mode (thus ruling out any mistake on our part) WIndsor 3.2.1 for
> .net 4 does indeed do the right thing, therefore rendering my suspicion
> that something in our build configuration might be off invalid.
>
> Miles, while your packages.config points to net40 version of the packages,
> perhaps your .csproj points to .net 4.5 version?
> Please check the output of your application, whether the version of Castle
> you're getting there is the one for .net 4.0 or .NET 4.5
>
> --
> Krzysztof Kozmic
>
> On Saturday, 28 September 2013 at 6:27 PM, Jonathon Rossi wrote:
>
> Krzysztof I took your word for it the other day that the .NET 4.0 binaries
> were compiled wrong, but after decompiling them with dotPeek I can't
> reproduce what you saw. Both the binaries in castle.windsor.3.2.1.nupkg and
> both the binaries in a local compile are as I expected.
>
> Miles and Krzysztof could you please check the binaries you have got.
> Maybe NuGet it giving you the wrong binary when you install it into a 4.0
> project.
>
> *\lib\net40:*
> [DebuggerHidden]
> public GetAssemblies>d__5(int <>1__state)
> {
> base..ctor();
> this.<>1__state = param0;
> this.<>l__initialThreadId = *Thread.CurrentThread.ManagedThreadId*
> ;
> }
>
> *\lib\net45:*
> [DebuggerHidden]
> public GetAssemblies>d__5(int <>1__state)
> {
> base..ctor();
> this.<>1__state = param0;
> this.<>l__initialThreadId = *Environment.CurrentManagedThreadId*;
> }
>
> On Thu, Sep 26, 2013 at 11:46 PM, Jonathon Rossi <[email protected]>
> wrote:
>
> Unfortunately I didn't have much luck getting much more time to look
> deeper into it on Tuesday. However, I've got it starred to look into it on
> the weekend.
>
> On Thu, Sep 26, 2013 at 2:33 PM, Krzysztof Koźmic <[email protected]>
> wrote:
>
> Any luck with that?
>
> On 24/09/2013 5:08 PM, "Jonathon Rossi" <[email protected]> wrote:
>
> Sorry for the delayed reply, I've been on leave.
>
> That is strange. Looking at the build logs for the last master build of
> the 4.0 and 4.5 build configurations it is picking the right mscorlib when
> calling csc, so I'd have expected the 4.0 one to fail compilation, unless
> that bit isn't actually "compiled".
> C:\Program Files (x86)\Reference
> Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll
> C:\Program Files (x86)\Reference
> Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll
>
> IIRC our old build machine didn't have .NET 4.5 on it, and since 4.5
> patches 4.0 that might have something to do with it.
>
> OK, I've found this article which describes the problem, but I don't know
> how to fix it yet because the reference assemblies are there and being
> used. I thought the .NET team would have learnt their lesson with 3.5SP1
> around patching previous versions.
>
> http://marcgravell.blogspot.de/2012/09/iterator-blocks-missing-methods-and-net.html
>
> I'll see if I can take another look later today.
>
> On Sat, Sep 21, 2013 at 9:05 AM, Krzysztof Kozmic <[email protected]>
> wrote:
>
> Hey Miles,
>
> very interesting. It would appear you're correct. The call to
> Environment.CurrentManagedThreadId is part of the compiler-generated state
> machine (notice yield return in the method).
>
> If you install Windsor 3.2 (instead of 3.2.1 that you're currently using)
> it works fine, so that may be a solution until we figure out what has gone
> wrong.
>
> It looks like our .NET 4.0 build does actually compile like .NET 4.5
>
>
> Jono - any idea what might be causing it? I'd suspect that it may have
> something to do with our migration to a new build server and some
> configuration difference between the two… Not that I really know what
> actually is the cause of that.
>
> --
> Krzysztof Kozmic
>
> On Saturday, 21 September 2013 at 4:22 AM, Miles Waller wrote:
>
> Hi,
>
> I upgraded a .net 4.0 project that was working fine to the latest packages
> I could get from nuget:
>
> <package id="Castle.Core" version="3.2.0" targetFramework="net40" />
> <package id="Castle.Windsor" version="3.2.1" targetFramework="net40" />
>
> The project builds and runs fine from the command line. I have VS 2012
> installed, so the 4.5 runtime exists on my machine too, however the project
> is 4.0 and I am using only 4.0 binaries.
>
> I then went to run the executable on a machine that did not have the 4.5
> runtime installed. My program blows up with this exception:
>
> An exception occurred creating the service: QuartzServer --->
> System.MissingMethodException: Method not found: 'Int32
> System.Environment.get_CurrentManagedThreadId()'.
> at
> Castle.MicroKernel.Registration.AssemblyFilter.<Castle.Core.Internal.IAssemblyProvider.GetAssemblies>d__5..ctor(Int32
> <>1__state)
> at
> Castle.MicroKernel.Registration.AssemblyFilter.Castle.Core.Internal.IAssemblyProvider.GetAssemblies()
> at
> Castle.MicroKernel.Registration.Classes.FromAssemblyInDirectory(AssemblyFilter
> filter)
>
> CurrentManagedThreadId is only available in the 4.5 runtime.
>
> Installing the 4.5 runtime on the target machine fixed the problem.
>
> Has something incompatible slipped into the releases? I looked on github
> but I couldn't find the root of this stack trace.
>
> Thanks
>
> Miles
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
> To post to this group, send email to [email protected].
>
>
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>
> --
> Jono
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
> To post to this group, send email to [email protected].
>
>
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
> To post to this group, send email to [email protected].
>
>
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> Jono
>
>
>
>
> --
> Jono
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
> To post to this group, send email to [email protected].
>
>
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected]
> .
> Visit this group at https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.