SteveSandersonMS / dotnet-wasi-sdk

Packages for building .NET projects as standalone WASI-compliant modules
518 stars 36 forks source link

Compilation error #9

Closed inkeliz closed 2 years ago

inkeliz commented 2 years ago

I'm testing C#, in order to port Karmem to C#.

I tried to create the "Hello World":

dotnet new console -o csharp
cd csharp
dotnet add package Wasi.Sdk --prerelease
dotnet build

However, the "Hello World" is not compiling, and reports:

C:\Users\lucas\.nuget\packages\wasi.sdk\0.1.0\build\Wasi.Sdk.targets(90,3): error MSB4018: Falha inesperada da tarefa "WasmResolveAssemblyDependencies". [X:\karmem\benchmark\csharp\csharp.c
sproj]
C:\Users\lucas\.nuget\packages\wasi.sdk\0.1.0\build\Wasi.Sdk.targets(90,3): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=7.0.0.0,
 Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. O sistema não pode encontrar o arquivo especificado. [X:\karmem\benchmark\csharp\csharp.csproj]
C:\Users\lucas\.nuget\packages\wasi.sdk\0.1.0\build\Wasi.Sdk.targets(90,3): error MSB4018: File name: 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [X:
\karmem\benchmark\csharp\csharp.csproj]
C:\Users\lucas\.nuget\packages\wasi.sdk\0.1.0\build\Wasi.Sdk.targets(90,3): error MSB4018:    at Wasi.Sdk.Tasks.WasmResolveAssemblyDependencies.Execute() [X:\karmem\benchmark\csharp\csharp.
csproj]
C:\Users\lucas\.nuget\packages\wasi.sdk\0.1.0\build\Wasi.Sdk.targets(90,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute
() [X:\karmem\benchmark\csharp\csharp.csproj]
C:\Users\lucas\.nuget\packages\wasi.sdk\0.1.0\build\Wasi.Sdk.targets(90,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecution
Host, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [X:\karmem\benchmark\csharp\csharp.csproj]

The error is located to Portuguese (and I don't know how to overwrite it, and I honestly hate that!).

But, in general, it says that don't find X:\karmem\benchmark\csharp\csharp.csproj, but running:

cd /X/karmem/benchmark/csharp
ls

Returns:

Program.cs  bin  csharp.csproj  obj

The file exists, but for some reason it doesn't find it. I'm using Windows.


Files:

Program.cs

// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

csharp.csproj


<Project Sdk="Microsoft.NET.Sdk">
Exe net6.0 enable enable

inkeliz commented 2 years ago

It needs .NET 7.0, instead of .NET 6.0. Also requires to use dotnet workload install wasm-tools. Then, the Hello World compiles.

Maybe, the README can include some information about .NET 7.0 and other dependencies.