@@ -160,31 +160,17 @@ public async ValueTask DisposeAsync()
160160 private async Task CreateWebWorkerLibrary ( string workerLibDir )
161161 {
162162 var hiveArg = $ "--debug:disable-sdk-templates --debug:custom-hive \" { TemplatePackageInstaller . CustomHivePath } \" ";
163- var args = $ "new webworker { hiveArg } -n WorkerLib -o \" { workerLibDir } \" ";
163+ var args = $ "new blazorwebworker { hiveArg } -n WorkerLib -o \" { workerLibDir } \" ";
164164
165165 using var result = ProcessEx . Run ( Output , AppContext . BaseDirectory , DotNetMuxer . MuxerPathOrDefault ( ) , args ) ;
166166 await result . Exited ;
167- Assert . True ( result . ExitCode == 0 , $ "Failed to create webworker template: { result . Output } \n { result . Error } ") ;
167+ Assert . True ( result . ExitCode == 0 , $ "Failed to create blazorwebworker template: { result . Output } \n { result . Error } ") ;
168168
169- ModifyWorkerLibProjectFile ( workerLibDir ) ;
169+ CopyWorkerMethods ( workerLibDir ) ;
170170
171- using var restoreResult = ProcessEx . Run ( Output , workerLibDir , DotNetMuxer . MuxerPathOrDefault ( ) , "restore" ) ;
171+ using var restoreResult = ProcessEx . Run ( Output , workerLibDir , DotNetMuxer . MuxerPathOrDefault ( ) , "restore" ) ;
172172 await restoreResult . Exited ;
173- Assert . True ( restoreResult . ExitCode == 0 , $ "Failed to restore webworker library: { restoreResult . Output } \n { restoreResult . Error } ") ;
174- }
175-
176- private static void ModifyWorkerLibProjectFile ( string workerLibDir )
177- {
178- var csprojPath = Path . Combine ( workerLibDir , "WorkerLib.csproj" ) ;
179- var content = File . ReadAllText ( csprojPath ) ;
180-
181- if ( ! content . Contains ( "AllowUnsafeBlocks" ) )
182- {
183- content = content . Replace (
184- "</PropertyGroup>" ,
185- " <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\n </PropertyGroup>" ) ;
186- File . WriteAllText ( csprojPath , content ) ;
187- }
173+ Assert . True ( restoreResult . ExitCode == 0 , $ "Failed to restore blazorwebworker library: { restoreResult . Output } \n { restoreResult . Error } ") ;
188174 }
189175
190176 private static void AddHostProjectSettings ( Project hostProject )
@@ -194,13 +180,8 @@ private static void AddHostProjectSettings(Project hostProject)
194180
195181 var settings = @"
196182 <PropertyGroup>
197- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
198183 <BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
199184 </PropertyGroup>
200-
201- <ItemGroup>
202- <SupportedPlatform Include=""browser"" />
203- </ItemGroup>
204185" ;
205186 content = content . Replace ( "</Project>" , settings + "</Project>" ) ;
206187 File . WriteAllText ( csprojPath , content ) ;
@@ -230,9 +211,12 @@ private void CopyTestAssets(Project hostProject)
230211 File . WriteAllText (
231212 Path . Combine ( pagesDir , "WebWorkerTest.razor" ) ,
232213 testComponentContent ) ;
214+ }
233215
216+ private static void CopyWorkerMethods ( string workerLibDir )
217+ {
234218 var workerMethodsSource = Path . Combine ( TestAssetsPath , "TestWorkerMethods.cs" ) ;
235- File . Copy ( workerMethodsSource , Path . Combine ( hostProject . TemplateOutputDir , "TestWorkerMethods.cs" ) , overwrite : true ) ;
219+ File . Copy ( workerMethodsSource , Path . Combine ( workerLibDir , "TestWorkerMethods.cs" ) , overwrite : true ) ;
236220 }
237221
238222 private void LogBuildDiagnostics ( Project hostProject , string buildKind )
0 commit comments