Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[net6.0][BlazorWasmSdk] build does not link native files #56783

Closed
emepetres opened this issue Jul 28, 2021 · 10 comments
Closed

[net6.0][BlazorWasmSdk] build does not link native files #56783

emepetres opened this issue Jul 28, 2021 · 10 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-Build-mono
Milestone

Comments

@emepetres
Copy link

Blazor WASM SDK only links native libraries on dotnet publish, so it is not possible to debug the solution while using native linking. The reason is that emscripten targets seems to be only executed on publish.

I've been playing with WasmBuildAppAfterThisTarget property but no luck.

How could I link native files on dotnet build?

Sample csproj:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <WasmBuildNative>true</WasmBuildNative>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0-rc.1.21376.14" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0-rc.1.21376.14" PrivateAssets="all" />
  </ItemGroup>

  <PropertyGroup>
    <UsingBrowserRuntimeWorkload>true</UsingBrowserRuntimeWorkload>
    <!-- <WasmBuildAppAfterThisTarget>Build</WasmBuildAppAfterThisTarget> -->
    <WasmBuildNative>true</WasmBuildNative>
  </PropertyGroup>

  <ItemGroup>
    <NativeFileReference Include="libTest.o" ScanForPInvokes="true" />
  </ItemGroup>

</Project> 
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@emepetres
Copy link
Author

Could anyone take a look into it? At least asign it to arch-wasm? thanks

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/sdk Aug 3, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Aug 3, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@mkArtakMSFT
Copy link
Member

Thanks for contacting us. I believe this is being fixed already. @lewing do you have an existing issue tracking the resolution?

1 similar comment
@mkArtakMSFT
Copy link
Member

Thanks for contacting us. I believe this is being fixed already. @lewing do you have an existing issue tracking the resolution?

@ghost
Copy link

ghost commented Aug 4, 2021

Tagging subscribers to this area:
See info in area-owners.md if you want to be subscribed.

Issue Details

Blazor WASM SDK only links native libraries on dotnet publish, so it is not possible to debug the solution while using native linking. The reason is that emscripten targets seems to be only executed on publish.

I've been playing with WasmBuildAppAfterThisTarget property but no luck.

How could I link native files on dotnet build?

Sample csproj:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <WasmBuildNative>true</WasmBuildNative>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0-rc.1.21376.14" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0-rc.1.21376.14" PrivateAssets="all" />
  </ItemGroup>

  <PropertyGroup>
    <UsingBrowserRuntimeWorkload>true</UsingBrowserRuntimeWorkload>
    <!-- <WasmBuildAppAfterThisTarget>Build</WasmBuildAppAfterThisTarget> -->
    <WasmBuildNative>true</WasmBuildNative>
  </PropertyGroup>

  <ItemGroup>
    <NativeFileReference Include="libTest.o" ScanForPInvokes="true" />
  </ItemGroup>

</Project> 
Author: emepetres
Assignees: -
Labels:

area-VM-meta-mono, untriaged

Milestone: -

@lewing lewing added the arch-wasm WebAssembly architecture label Aug 4, 2021
@ghost
Copy link

ghost commented Aug 4, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Blazor WASM SDK only links native libraries on dotnet publish, so it is not possible to debug the solution while using native linking. The reason is that emscripten targets seems to be only executed on publish.

I've been playing with WasmBuildAppAfterThisTarget property but no luck.

How could I link native files on dotnet build?

Sample csproj:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <WasmBuildNative>true</WasmBuildNative>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0-rc.1.21376.14" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0-rc.1.21376.14" PrivateAssets="all" />
  </ItemGroup>

  <PropertyGroup>
    <UsingBrowserRuntimeWorkload>true</UsingBrowserRuntimeWorkload>
    <!-- <WasmBuildAppAfterThisTarget>Build</WasmBuildAppAfterThisTarget> -->
    <WasmBuildNative>true</WasmBuildNative>
  </PropertyGroup>

  <ItemGroup>
    <NativeFileReference Include="libTest.o" ScanForPInvokes="true" />
  </ItemGroup>

</Project> 
Author: emepetres
Assignees: radical
Labels:

arch-wasm, area-VM-meta-mono, untriaged

Milestone: -

@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Aug 4, 2021
@lewing lewing added this to the 6.0.0 milestone Aug 4, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 26, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Sep 16, 2021
@radical
Copy link
Member

radical commented Sep 16, 2021

Changes have merged, but waiting to test that with VS before closing this.

@radical radical closed this as completed Sep 21, 2021
@emepetres
Copy link
Author

@radical did you test it linking a native library? Usint latest VS2022, and a vanilla client blazor app linking a native library, I'm getting the following error:

imagen

@radical
Copy link
Member

radical commented Sep 21, 2021

@radical did you test it linking a native library? Usint latest VS2022, and a vanilla client blazor app linking a native library, I'm getting the following error:

imagen

The latest bits with these changes are not in the VS preview yet. You need to install the latest rc2 sdk from https://github.com/dotnet/installer . And then install the Wasm-tools workload.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants