Search code examples
c#releasewindows-api-code-pack

C# Windows forms Application Reference error in release


I have my windows forms application with WindowsAPICodePack but i don't know where should I put the package in the release folder, and without it the program just gives me an error (it's in Hungarian so I don't think anybody can understand, but it said that it can't find the windowsAPICodePack, the version number, culture and publickeytoken) on another PC, on mine it works.


Solution

  • Depending on if your application is using a packages.config file to manage packages or if your project is using package references (PackageReference) will determine path to solution.

    When a package is installed it records the package identifier and version into the project file or packages.config file in your solution workspace.

    1. If using a package.config to mange packages then ensure your packages are getting installed in the location as expected, possibly clearing the cache will help to ensure proper version is installed.
    2. find out the packages folder where your application is trying to load the references.
    3. Possibly config binding redirects.
    4. Clear you package cache and reinstall. use the package manager ui for your ‘debug’ and ‘release’ MSBuild configs to ensure the package is being referenced correctly.
    5. Verify your nuget.xml settings file for locations of packages
    6. Read all the version or property values to use for your application. Ensure you are configuring the release target as expected.

    Here are some links to help you config the correct setup for your approach:

    Package reference via project files

    if using - Packages.config settings

    Config setting for Nuget NuGet settings


    Note: for simplicity if this is just a school project then just remove all NuGet packages references and find the dll . Then just add reference to dll and check the property to include in output . This will give you a simple folder with all the files needed to run your app from pen-drive