none
Topshelf 4.2.1' Fails to integrate with Console Application Targeting .Net Framework 4.0 RRS feed

  • Question

  • Hi good day to all,

    I was trying to create window service through Topshelf. when i try to install this through PM (package manager) under the command. 

    PM> Install-Package TopShelf

    I gets the error as below

    Install-Package : Could not install package 'Topshelf 4.2.1'. You are trying to install this package into a project that
     targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
    At line:1 char:16

    I am using Visual Studio 2010 Ultimate Version.

    Can you please help me out about the fix. Thank you 


    Friday, November 29, 2019 2:36 PM

All replies

  • Hi friend,

    Welcome to MSDN forum.

    According to your description,

    >> Could not install package 'Topshelf 4.2.1'. You are trying to install this package into a project that
     targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

    ## The error message means that you are trying to install the package to a higher framework project. In general, when installing this package in a project that targets .NET Framework 4.0, the highest available version of NuGet should be less than or equal to 4.0. You could refer to the link.

    So, I suggest you go to the folder (C:\Users\[username]\.nuget\packages\[package name]\4.2.1\lib). Then, please backup the name and  rename the folder with the .NET version of your project.

    In addition, you could have a look at the similar issue and I hope it could help you.

    Any problem persists please feel free to contact us.

    Best Regards,

    Anna 


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, December 2, 2019 5:08 AM
  • Hi Muhammad Saeed Talib,

    Sorry to disturb you.

    I think this error might be caused by the confliction of the framework of your project and the version of this package.

    Which means, .NET Framework version 4.0 might not support TopShelf version 4.2.1.

    I have tested and reproduced your issue in my side using Visual Studio Ultimate 2010 and I found that if I change to download and install a lower version of TopShelf package like version 3.3.1, the package will be installed successfully.

    So, I suggest, if possible, you could try to download and use earlier version of TopShelf package (Please refer to NuGet package Topshelf for earlier version) and use the command line like Install-Package TopShelf –version 3.3.1 to point to a specified version.

    Any feedback would be great expected.

    Sincerely,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 3, 2019 7:41 AM
  • Hi friend

    Sorry to disturb you.

    Are our suggestions useful for you to solve your issue?

    If our replies don’t work, please feel free to contact us, we can help you research it again.

    If you have resolved it, you can share the solution here, which will be beneficial for other members with the same issue.

    We are looking forward to hearing from you.

    Best Regards,

    Anna

    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Thursday, December 5, 2019 9:59 AM