@@ -13,12 +13,14 @@ public class WasmGenerator : CsProjGenerator
1313 {
1414 private readonly string CustomRuntimePack ;
1515 private readonly bool Aot ;
16+ private readonly string MainJS ;
1617
1718 public WasmGenerator ( string targetFrameworkMoniker , string cliPath , string packagesPath , string customRuntimePack , bool aot )
1819 : base ( targetFrameworkMoniker , cliPath , packagesPath , runtimeFrameworkVersion : null )
1920 {
2021 Aot = aot ;
2122 CustomRuntimePack = customRuntimePack ;
23+ MainJS = ( targetFrameworkMoniker == "net5.0" || targetFrameworkMoniker == "net6.0" ) ? "main.js" : "test-main.js" ;
2224 }
2325
2426 protected override void GenerateProject ( BuildPartition buildPartition , ArtifactsPaths artifactsPaths , ILogger logger )
@@ -56,6 +58,7 @@ protected void GenerateProjectAot(BuildPartition buildPartition, ArtifactsPaths
5658 . Replace ( "$COPIEDSETTINGS$" , customProperties )
5759 . Replace ( "$CONFIGURATIONNAME$" , buildPartition . BuildConfiguration )
5860 . Replace ( "$SDKNAME$" , sdkName )
61+ . Replace ( "$MAINJS$" , MainJS )
5962 . ToString ( ) ;
6063
6164 File . WriteAllText ( artifactsPaths . ProjectFilePath , content ) ;
@@ -84,14 +87,15 @@ protected void GenerateProjectInterpreter(BuildPartition buildPartition, Artifac
8487 . Replace ( "$CONFIGURATIONNAME$" , buildPartition . BuildConfiguration )
8588 . Replace ( "$SDKNAME$" , sdkName )
8689 . Replace ( "$RUNTIMEPACK$" , CustomRuntimePack ?? "" )
90+ . Replace ( "$MAINJS$" , MainJS )
8791 . Replace ( "$TARGET$" , CustomRuntimePack != null ? "PublishWithCustomRuntimePack" : "Publish" )
8892 . ToString ( ) ;
8993
9094 File . WriteAllText ( artifactsPaths . ProjectFilePath , content ) ;
9195 }
9296 }
9397
94- protected override string GetExecutablePath ( string binariesDirectoryPath , string programName ) => Path . Combine ( binariesDirectoryPath , "main.js" ) ;
98+ protected override string GetExecutablePath ( string binariesDirectoryPath , string programName ) => Path . Combine ( binariesDirectoryPath , MainJS ) ;
9599
96100 protected override string GetBinariesDirectoryPath ( string buildArtifactsDirectoryPath , string configuration )
97101 {
0 commit comments