97
97
// but that's not expressible in hclspec. Marking both as optional
98
98
// and setting checking explicitly later
99
99
"dll_path" : hclspec .NewAttr ("dll_path" , "string" , true ),
100
- "app_name" : hclspec .NewAttr ("app_name" , "string" , true ),
101
100
"runtime_version" : hclspec .NewAttr ("runtime_version" , "string" , false ),
102
101
"gc" : hclspec .NewBlock ("gc" , false , hclspec .NewObject (map [string ]* hclspec.Spec {
103
102
"enable" : hclspec .NewAttr ("enable" , "bool" , false ),
@@ -212,9 +211,6 @@ type TaskConfig struct {
212
211
// DotnetPath indicates where a dll file is found.
213
212
DotnetPath string `codec:"dll_path"`
214
213
215
- // AppName indicates the .Net application name.
216
- AppName string `codec:"app_name"`
217
-
218
214
// SdkVersion indicates which version of dotnet the task must be run
219
215
RuntimeVersion * string `codec:"runtime_version"`
220
216
@@ -492,14 +488,15 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
492
488
return nil , nil , err
493
489
}
494
490
495
- args := dotnetCmdArgs (taskConfig )
491
+ args := dotnetCmdArgs (* cfg , taskConfig )
496
492
497
493
var fileConfig = new (ConfigFile )
498
494
addGcConfig (taskConfig .GC , fileConfig )
499
495
addGlobalizationConfig (taskConfig .Globalization , fileConfig )
500
496
addThreadingConfig (taskConfig .Threading , fileConfig )
501
497
502
- dotnetConfigPath := path .Join (cfg .TaskDir ().LocalDir , fmt .Sprintf ("%s.runtimeconfig.json" , taskConfig .AppName ))
498
+ appName , _ := getDotnetAppName (taskConfig .DotnetPath )
499
+ dotnetConfigPath := path .Join (cfg .TaskDir ().LocalDir , fmt .Sprintf ("%s.runtimeconfig.json" , appName ))
503
500
504
501
if content , err := os .ReadFile (dotnetConfigPath ); ! os .IsNotExist (err ) {
505
502
var parsedConfig = new (ConfigFile )
@@ -514,10 +511,10 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
514
511
data , _ := json .Marshal (fileConfig )
515
512
fo , err := os .Create (dotnetConfigPath )
516
513
if err != nil {
517
- return nil , nil , fmt .Errorf ("failed to create %s.runtimeconfig.json: %v" , taskConfig . AppName , err )
514
+ return nil , nil , fmt .Errorf ("failed to create %s.runtimeconfig.json: %v" , appName , err )
518
515
}
519
516
if _ , err := fo .Write (data ); err != nil {
520
- return nil , nil , fmt .Errorf ("failed to write %s.runtimeconfig.json: %v" , taskConfig . AppName , err )
517
+ return nil , nil , fmt .Errorf ("failed to write %s.runtimeconfig.json: %v" , appName , err )
521
518
}
522
519
defer func (fo * os.File ) {
523
520
err := fo .Close ()
@@ -625,7 +622,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
625
622
return handle , nil , nil
626
623
}
627
624
628
- func dotnetCmdArgs (taskConfig TaskConfig ) []string {
625
+ func dotnetCmdArgs (driverConfig drivers. TaskConfig , taskConfig TaskConfig ) []string {
629
626
var args []string
630
627
631
628
//Add runtime version
@@ -635,7 +632,7 @@ func dotnetCmdArgs(taskConfig TaskConfig) []string {
635
632
636
633
// Add the dll
637
634
if taskConfig .DotnetPath != "" {
638
- args = append (args , taskConfig .DotnetPath )
635
+ args = append (args , fmt . Sprintf ( "%s/%s" , driverConfig . TaskDir (). LocalDir , taskConfig .DotnetPath ) )
639
636
}
640
637
641
638
// Add any args
0 commit comments