Can't compile a c# project (powershell host) on windows 10 targeting .net 4.0

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 7 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35381
    Profile photo of Alexander Knopp
    Alexander Knopp
    Participant

    I have a project which can be compiled without problems on windows 7. Now I am trying to move to windows 10 and the exact same project can not be compiled on windows 10.

    I have a german environment so I will try to translate the error message.

    The primary reference "system.management.automation" (version 3.0.0.0) could not be resolved, because it has a dependence to Microsoft.Management.Infrastructure.Native (version 1.0.0.0) which is build on .net framework 4.5.

    because of this message i tried to change my target framework to point to .net 4.5. targeting 4.5 it works fine, but because of other assemblies I need to compile everything with .net 4.

    As I mentioned, on a windows 7 machine the exact same code can be compiled without any issues.

    It is my first post on powershell.org and I hope this is the correct forum for my question.
    Thanks in advance
    Alex

    #35438
    Profile photo of Don Jones
    Don Jones
    Keymaster

    The difference is that Win10 comes with, and only runs, PowerShell v5, which itself was compiled against the later .NET Framework version. Win7 can run a variety of PowerShell versions, which have their own .NET dependencies. This is something that developers are more or less constantly dealing with – you really have to get everything lined up against a particular version. In the case of Win10, because it can only run PowerShell v5, you'll have to get everything happy running in that version.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.