Closed kaeedo closed 3 years ago
Hi, I think there must be something with your dotnet installation. I have no problems running your example
➜ minimal git:(master) ✗ dotnet publish -r win-x64 -c Release -p:PublishSingleFile=true --self-contained true -o "./output" ./minimal.fsproj
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored /Users/dbrattli/Developer/Github/oryx/examples/minimal/minimal.fsproj (in 333 ms).
minimal -> /Users/dbrattli/Developer/Github/oryx/examples/minimal/bin/Release/net5/win-x64/minimal.dll
minimal -> /Users/dbrattli/Developer/Github/oryx/examples/minimal/output/
➜ minimal git:(master) ✗ dotnet run output/minimal.exe
Ok "v3.0.0-alpha-001"
Here is the project file I used:
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Oryx" Version="2.0.0" />
<PackageReference Include="Oryx.ThothJsonNet" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Ply" Version="0.3.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
</Project>
I think you're right. I managed to get it working when targeting netcoreapp3.1
, but still building using the net 5 SDK. I'll play around with my dotnet installation.
Thanks
Hello. I'm trying to use Oryx in a project that I want to distribute as a self contained single file executable. The project runs no problem when using normal
dotnet build
, but when I build a self contained exe, it throws aTypeInitializationException
. Full message:Command I used to build self contained exe:
dotnet publish -r win-x64 -c Release -p:PublishSingleFile=true --self-contained true -o "./output" .\MyProj.fsproj
And here a minimal project to reproduce:
Program.fs:
with following dependencies:
Thank you for this project, and any help you may be able to provide