简体   繁体   中英

c# dotnet project fails to run: assembly file not found

I am trying to get a dotnet project running under Debian 9.9 (stretch).

I cloned the repository from here: https://github.com/Montesuma80/3cx-web-API

After installing the dotnet packages (3.1 SDK from the Microsoft repository), building failed, as a dependency listed was not found. I edited the the.csproj file to match the actual location of the dll file on my system in the HintPath-Tag (its a phone system installed locally):

  <ItemGroup>
    <Reference Include="3cxpscomcpp2">
      <HintPath>/usr/lib/3cxpbx/3cxpscomcpp2.dll</HintPath>
      <Private>false</Private>
    </Reference>
  </ItemGroup>

After this change, the code compiled successfully.

But when running the compiled code, I get the following error:

System.IO.FileNotFoundException: Could not load file or assembly '3cxpscomcpp2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=53c4927ce4749cb4'. The system cannot find the file specified.

File name: '3cxpscomcpp2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=53c4927ce4749cb4'
   at WebAPI.Program.Bootstrap(String[] args)
   at WebAPI.Program.Main(String[] args) in /root/webapi/3cx-web-API/Program.cs:line 418

The file does exist in the path specified. I tried deleting the bin and obj folders an starting over while copying the dll to the project dir, same result. Building works fine but running fails to find the assembly. I checked the version of dll file on my system, 2.0.0.0 is the correct version.

I would really appreciate any help.

Remove

<Private>False</Private>

from Reference
When it's set - dll is not copied to bin folder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM