Closed jeisonjei closed 3 years ago
I should work fine in .NET core however the error you are seeing is from using it in 64bit which it does not (yet) support.
1) Right click on your project
2) Select "Configuration manager"
3) Below 'Platform' click on 'Any CPU'
4) Select '
Yes, it works, thank you! Actually my problem is that I want to use this library for Blazor application which is on .netstandard2.1. Is it possible to make it working on .netstandard?
I have just updated the Nuget so It should/might work on .netstandard2.1 Can you test if it does?
Just tried, on my computer doesn't work Here is the code:
@page "/"
<div class="row">
<div class="col-4">
<div class="row">
<div class="col">
<button class="btn btn-info btn-lg" @onclick="ShowDensity">Show Density</button>
</div>
<div class="col">
<h2>@Result</h2>
</div>
</div>
</div>
</div>
@code {
public double Result { get; set; }
public void ShowDensity()
{
Fluid air = new Fluid(FluidList.Air);
air.UpdatePT(Pressure.FromBars(1.013), Temperature.FromDegreesCelsius(13));
Result = air.Density.Value;
}
}
Here is the error from page:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: The type initializer for 'CoolPropPINVOKE' threw an exception. System.TypeInitializationException: The type initializer for 'CoolPropPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: CoolProp assembly:<unknown assembly> type:<unknown type> member:(null) at (wrapper managed-to-native)
...
Active project platform is x86
It looks like it cant find the 'CoolProp.DLL'
Im not sure if a Blazor application does something special but you can try to manually place the DLL into it output folder and see if that in fact in the real error
I actually don't know, but maybe this could tell something:
#r "C:\Users\Danil\.nuget\packages\sharpfluids\2.0.9"
(1,1): error CS0006: Metadata file 'C:\Users\Danil\.nuget\packages\sharpfluids\2.0.9' could not be found
> #r "C:\Users\Danil\Documents\CodingTrainer\a01\Client\bin\Debug\netstandard2.1\CoolProp.dll"
(1,1): error CS0009: Metadata file 'C:\Users\Danil\Documents\CodingTrainer\a01\Client\bin\Debug\netstandard2.1\CoolProp.dll' could not be opened -- PE image doesn't contain managed metadata.
Well, I eventually have found the answer - since all code in Blazor WebAssembly executes in the browser, framework kind of convert all code to WebAssembly. And since SharpFluids uses CoolProp.dll library, Blazor can't use it. Explanation is here https://stackoverflow.com/questions/66966926/c-dll-in-blazor-project But it's completely possible to use SharpFluids in Blazor Server app
Hello, unfortunately library doesn't work with .netcore console app on my computer. Error on the line
Fluid air=new Fluid(FluidList.Air);
Details below: