-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Errors when getting started #155
Comments
The recurring error stopped after I closed Visual Studio, started Visual Studio Installer, clicked Modify on VS 2022, clicked "ASP.NET and web development" (making sure it is checked), selected ".NET 7.0 WebAssembly Build Tools" and ".NET WebAssembly Build Tools", clicked Modify and waited... The new project still does not build due to a Bootsharp-related error:
Note: since it mentions |
Min. supported .NET version is 8.0. Check any of the sample projects for reference. Regarding visual studio, see #137 |
Okay, I'm puzzled that the output shows no signs of any wrapping/interop. For example, given this code using Microsoft.JSInterop;
public class Program {
public static void Main() { }
[JSInvokable] public static string GetHello() => "hello there!!!!";
} and this project <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.JSInterop" Version="8.0.1" />
<PackageReference Include="Bootsharp" Version="0.3.1" />
</ItemGroup>
</Project> I get 4 MB file called index.mjs, but there is no sign of import bootsharp from 'bootsharp/index.mjs';
bootsharp.boot().then(() => {
console.log(bootsharp);
}); |
Please read the issue I've linked above.
Again, please, read the guide and/or check the samples. It should be |
I did. That's why I said "Okay, dotnet build and dotnet publish work while Visual Studio won't build."
It's not only missing at runtime. There is no sign of Program anywhere. It cannot be imported. |
Have you checked the samples? They're all working fine on my end. |
This issue is stale because it has been open 14 days with no activity. It will be automatically closed in 7 days. |
My first problem was that the
JSInvokable
attribute mentioned in the guide does not exist. I tried adding<PackageReference Include="Microsoft.JSInterop" Version="7.0.19" />
to my .NET 7 project, but this doesn't help and the Microsoft.JSInterop package has a yellow warning icon in the package list.My second problem is this error when building:
dotnet workload restore
says:This refers to a test project that I do not want to compile to Wasm, so I change the command to say
This appears to install various things (after demanding Administrator permissions), and says
but the Microsoft.JSInterop package icon is still yellow and the build fails with the same error:
If I remove the reference to
Bootsharp
, I get a different error instead:I also tried upgrading to .NET 8, but it doesn't help; the error just changes to
And again, the command above installs some things but it doesn't remove the error.
Since my project uses several other packages, I thought maybe those could be causing a problem, so I created a new empty project called DeleteMe. In the empty project I am able to use the
JSInvokable
attribute and the Microsoft.JSInterop package does not have a yellow warning icon, but adding<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
causes the same error:Again,
dotnet workload restore --project .\DeleteMe\DeleteMe.csproj
doesn't help. It doesn't seem to matter whether I reference Bootsharp or not. Any ideas how to fix this?Finally, if Bootsharp is referenced and
browser-wasm
is not, then the error changes toDoes Bootsharp require a
Main()
?The text was updated successfully, but these errors were encountered: