AmpScm / SharpProj

.Net / C# wrapping of PROJ
Apache License 2.0
36 stars 8 forks source link

FileNotFoundException SharpProj.dll for Microsoft.NET.Sdk.Web #52

Open elliz opened 1 year ago

elliz commented 1 year ago

We have SharpProj working in unit test and console .net6 projects using Microsoft.NET.Sdk

When we try to run it in an api using Microsoft.NET.Sdk.Web then we get the following error (even though the dll is found in the same place in bin as the console app.

Could not load file or assembly 'SharpProj, Version=9.2000.234.0, Culture=neutral, PublicKeyToken=3a930e679d9a0873'. The system cannot find the file specified.

looking at the output pane in VS can see this:

Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll

Copying the appropriate dll using post build scripts does not work either, or forcing ijwhost.dll.

radokostelnik commented 9 months ago

I got the same error. What helped in my case (when starting the project in Visual Studio) was to set the Working directory to the the same as <OutputPath>. Without that, the process looked for ijwhost.dll everywhere in %PATH%, except for the actual folder, where the main .exe was.

harry-dickson commented 3 months ago

I find that this helps:

  <PropertyGroup>
    <usual>stuff</usual>
    <UseIJWHost>true</UseIJWHost> <!-- this right here! -->
 </PropertyGroup>