Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Rider - Nuget Package cannot be used in Code after a few seconds?

Discussion in 'Editor & General Support' started by F00buzz, Apr 23, 2020.

  1. F00buzz

    F00buzz

    Joined:
    Oct 4, 2016
    Posts:
    11
    I'm using Rider to write code in for Unity.
    Rider has Nuget integration and I need to install a dependency (CsvHelper).

    So I Installed the CsvHelper Package (you can choose the scope, I chose Assembly-C-Sharp, but you can also Choose "Solution" , both don't work.

    After that, the Package can be used in the Code,

    Code (CSharp):
    1. using CsvHelper;
    2.  
    It will work for a short time, and you can open the Class and decompile it with jetbrains rider.

    But like 10 Seconds later, Rider can't use the package in the code anymore:

    The Package is still available
    Code (CSharp):
    1. // Assembly location: /Users/grauen/RiderProjects/Demo/packages/CsvHelper.15.0.5/lib/net47/CsvHelper.dll
    2.  
    When Compiling there is an error:
    Code (CSharp):
    1. LocalizedDialogResolver.cs(4, 7): [CS0246] The type or namespace name 'CsvHelper' could not be found (are you missing a using directive or an assembly reference?)

    Can you help me?
     
  2. F00buzz

    F00buzz

    Joined:
    Oct 4, 2016
    Posts:
    11
    I noticed that there is an Folder "References -> Assemblies", I can import the dll here. Then everything works - I can even build the project. But then the dll seems to disappear again.

    Edit: might be related but didn't help me though:
    https://docs.unity3d.com/Manual/dotnetProfileAssemblies.html
     
  3. F00buzz

    F00buzz

    Joined:
    Oct 4, 2016
    Posts:
    11
  4. valdeezzee

    valdeezzee

    Joined:
    Jan 21, 2014
    Posts:
    7
    I'm trying to get this to work as well and I can't figure it out. I have followed what you did and I keep getting errors.

    What I did was installed CsvHelper package through NuGet. The reference is added in Visual studio. Then I added the dll to the assets folder in Unity.

    I get these error:

    Assembly 'Assets/CsvHelper.dll' will not be loaded due to errors:
    Unable to resolve reference 'Microsoft.Bcl.AsyncInterfaces'. Is the assembly missing or incompatible with the current platform?
    Reference validation can be disabled in the Plugin Inspector.

    Unable to resolve reference 'System.Threading.Tasks.Extensions'. Is the assembly missing or incompatible with the current platform?
    Reference validation can be disabled in the Plugin Inspector.

    Have you had these errors before?
     
  5. valdeezzee

    valdeezzee

    Joined:
    Jan 21, 2014
    Posts:
    7
    I figured it out. CsvHelper installs other packages. Microsoft.Bcl.AsyncInterfaces and System.Threading.Tasks.Extensions. I added their dlls from their package locations and added them to the Assets folder.
     
  6. F00buzz

    F00buzz

    Joined:
    Oct 4, 2016
    Posts:
    11
  7. Estellise-Yukihime

    Estellise-Yukihime

    Joined:
    Aug 9, 2018
    Posts:
    9
    Hi @valdeezzee, I couldn't seem to find the other dll's when I downloaded the CsvHelper .nuget where did you find yours? where did you find the Microsoft.Bcl.AsyncInterfaces dll?
     
  8. valdeezzee

    valdeezzee

    Joined:
    Jan 21, 2014
    Posts:
    7
    @Estellise-Yukihime In Visual Studio go to your Solution Explorer. In there you should see a section named Assembly-CSharp-firstpass. Under that section, there should be a References section. Search for your dll.

    AsyncInterfaces.png

    Once you find the dll, select it. In your Properties window, it will show the path where your dll is located.

    dllpath.png