Skip to content

Conversation

mkhamoyan
Copy link
Contributor

@mkhamoyan mkhamoyan commented May 29, 2024

By this PR we are supporting library mode for wasi.

Here are all possibilites to build wasi.

  1. Create exe
    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <OutputType>Exe</OutputType>
        ...
      </PropertyGroup>
    </Project>
    
  2. Use wasi specific C# api in standard library
    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <OutputType>Library</OutputType>
        <RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>
        ...
      </PropertyGroup>
     </Project>
    
  3. Create Wasm library
      <Project Sdk="Microsoft.NET.Sdk.WebAssembly">
        <PropertyGroup>
          <OutputType>Library</OutputType>
          <RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>
          ...
        </PropertyGroup>
       </Project>
    

Fixes #96869

@ghost ghost added the area-Build-mono label May 29, 2024
@mkhamoyan mkhamoyan added arch-wasm WebAssembly architecture os-wasi Related to WASI variant of arch-wasm labels May 29, 2024
@ilonatommy
Copy link
Member

Doesn't it fix #89577 as well?

@mkhamoyan
Copy link
Contributor Author

mkhamoyan commented Jun 3, 2024

Doesn't it fix #89577 as well?

No, these changes are for wasi.

@lewing
Copy link
Member

lewing commented Jun 5, 2024

Is this waiting for other changes or ready to go?

@mkhamoyan
Copy link
Contributor Author

Is this waiting for other changes or ready to go?

@lewing It is ready to go unless there are further changes needed based on the review.

Copy link
Member

@maraf maraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@mkhamoyan
Copy link
Contributor Author

Failures are not related to PR changes.

@mkhamoyan mkhamoyan merged commit 8fdba2b into dotnet:main Jun 7, 2024
@mkhamoyan mkhamoyan deleted the wasm_library_mode branch June 7, 2024 12:02
@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono os-wasi Related to WASI variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[wasm][wasi] No main function should be required when building a library
6 participants