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
@@ -499,7 +495,8 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
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 ()
0 commit comments