@@ -300,10 +300,12 @@ void AssertFile(string suffix)
300300 }
301301 }
302302
303- [ Theory ]
304- // [InlineData(false)] https://github.com/dotnet/runtime/issues/123477
305- [ InlineData ( true ) ]
306- public async Task LibraryModeBuild ( bool useWasmSdk )
303+ [ Theory , TestCategory ( "no-workload" ) ]
304+ [ InlineData ( false , false ) ]
305+ [ InlineData ( false , true ) ]
306+ [ InlineData ( true , false ) ]
307+ [ InlineData ( true , true ) ]
308+ public async Task LibraryMode ( bool useWasmSdk , bool isPublish )
307309 {
308310 var config = Configuration . Release ;
309311 ProjectInfo info = CopyTestAsset ( config , aot : false , TestAsset . LibraryModeTestApp , "libraryMode" ) ;
@@ -313,13 +315,22 @@ public async Task LibraryModeBuild(bool useWasmSdk)
313315 { "Microsoft.NET.Sdk.WebAssembly" , "Microsoft.NET.Sdk" }
314316 } ) ;
315317 }
316- BuildProject ( info , config , new BuildOptions ( AssertAppBundle : useWasmSdk ) ) ;
318+
319+ // Without WASM SDK, the project is a plain library with browser-wasm RID.
320+ // It should build and publish successfully but won't produce a wasm app bundle.
321+ if ( isPublish )
322+ PublishProject ( info , config , new PublishOptions ( AssertAppBundle : useWasmSdk ) ) ;
323+ else
324+ BuildProject ( info , config , new BuildOptions ( AssertAppBundle : useWasmSdk ) ) ;
325+
317326 if ( useWasmSdk )
318327 {
319- var result = await RunForBuildWithDotnetRun ( new BrowserRunOptions ( config , ExpectedExitCode : 100 ) ) ;
328+ var result = isPublish
329+ ? await RunForPublishWithWebServer ( new BrowserRunOptions ( config , ExpectedExitCode : 100 ) )
330+ : await RunForBuildWithDotnetRun ( new BrowserRunOptions ( config , ExpectedExitCode : 100 ) ) ;
331+
320332 Assert . Contains ( "WASM Library MyExport is called" , result . TestOutput ) ;
321333 }
322-
323334 }
324335
325336 [ Theory ]
0 commit comments