From f3fa7bcaef96bee1f392af807e711475a5a73b0f Mon Sep 17 00:00:00 2001 From: Harikrishnan Balagopal Date: Wed, 9 Nov 2022 21:47:59 +0530 Subject: [PATCH] fix: bug where the .dll filename was normalized when it shouldn't be in the Dockerfiles generated for Dot Net Core Also add support for Dot Net Framework version 3.5 Signed-off-by: Harikrishnan Balagopal --- .../dockerfilegenerator/dotnetcoredockerfilegenerator.go | 2 +- .../windows/consoleappdockerfilegenerator.go | 2 +- .../windows/silverlightwebappdockerfilegenerator.go | 2 +- .../windows/webappdockerfilegenerator.go | 8 ++++---- types/source/dotnet/csproj.go | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/transformer/dockerfilegenerator/dotnetcoredockerfilegenerator.go b/transformer/dockerfilegenerator/dotnetcoredockerfilegenerator.go index 740569af4..f5089e845 100644 --- a/transformer/dockerfilegenerator/dotnetcoredockerfilegenerator.go +++ b/transformer/dockerfilegenerator/dotnetcoredockerfilegenerator.go @@ -474,7 +474,7 @@ func (t *DotNetCoreDockerfileGenerator) TransformArtifact(newArtifact transforme IncludeBuildStage: selectedBuildOption == dotnetutils.BUILD_IN_EVERY_IMAGE, BuildStageImageTag: defaultDotNetCoreVersion, BuildContainerName: imageToCopyFrom, - EntryPointPath: childProject.Name + ".dll", + EntryPointPath: childProject.OriginalName + ".dll", RunStageImageTag: targetFrameworkVersion, IncludeRunStage: true, CopyFrom: common.GetUnixPath(copyFrom), diff --git a/transformer/dockerfilegenerator/windows/consoleappdockerfilegenerator.go b/transformer/dockerfilegenerator/windows/consoleappdockerfilegenerator.go index d96c186a6..48523dcc1 100644 --- a/transformer/dockerfilegenerator/windows/consoleappdockerfilegenerator.go +++ b/transformer/dockerfilegenerator/windows/consoleappdockerfilegenerator.go @@ -200,7 +200,7 @@ func (t *WinConsoleAppDockerfileGenerator) DirectoryDetect(dir string) (map[stri continue } targetFrameworkVersion := configuration.PropertyGroups[idx].TargetFrameworkVersion - if !dotnet.Version4.MatchString(targetFrameworkVersion) { + if !dotnet.Version4And3_5.MatchString(targetFrameworkVersion) { logrus.Errorf("console dot net tranformer: the c sharp project file at path %s does not have a supported framework version. Actual version: %s", csProjPath, targetFrameworkVersion) continue } diff --git a/transformer/dockerfilegenerator/windows/silverlightwebappdockerfilegenerator.go b/transformer/dockerfilegenerator/windows/silverlightwebappdockerfilegenerator.go index babe22e4e..e6d17c82b 100644 --- a/transformer/dockerfilegenerator/windows/silverlightwebappdockerfilegenerator.go +++ b/transformer/dockerfilegenerator/windows/silverlightwebappdockerfilegenerator.go @@ -104,7 +104,7 @@ func (t *WinSilverLightWebAppDockerfileGenerator) DirectoryDetect(dir string) (m continue } targetFrameworkVersion := configuration.PropertyGroups[idx].TargetFrameworkVersion - if !dotnet.Version4.MatchString(targetFrameworkVersion) { + if !dotnet.Version4And3_5.MatchString(targetFrameworkVersion) { logrus.Errorf("silverlight dot net tranformer: the c sharp project file at path %s does not have a supported framework version. Actual version: %s", csProjPath, targetFrameworkVersion) continue } diff --git a/transformer/dockerfilegenerator/windows/webappdockerfilegenerator.go b/transformer/dockerfilegenerator/windows/webappdockerfilegenerator.go index 615448c96..a77f24bf4 100644 --- a/transformer/dockerfilegenerator/windows/webappdockerfilegenerator.go +++ b/transformer/dockerfilegenerator/windows/webappdockerfilegenerator.go @@ -113,7 +113,7 @@ func (t *WinWebAppDockerfileGenerator) DirectoryDetect(dir string) (map[string][ continue } targetFrameworkVersion := configuration.PropertyGroups[idx].TargetFrameworkVersion - if !dotnet.Version4.MatchString(targetFrameworkVersion) { + if !dotnet.Version4And3_5.MatchString(targetFrameworkVersion) { logrus.Errorf("the c sharp project file at path %s does not have a supported framework version. Actual version: %s", csProjPath, targetFrameworkVersion) continue } @@ -175,7 +175,7 @@ func (t *WinWebAppDockerfileGenerator) DirectoryDetect(dir string) (map[string][ continue } targetFrameworkVersion := configuration.PropertyGroups[idx].TargetFrameworkVersion - if !dotnet.Version4.MatchString(targetFrameworkVersion) { + if !dotnet.Version4And3_5.MatchString(targetFrameworkVersion) { logrus.Errorf("webapp dot net tranformer: the c sharp project file at path %s does not have a supported framework version. Actual version: %s", csProjPath, targetFrameworkVersion) continue } @@ -306,7 +306,7 @@ func (t *WinWebAppDockerfileGenerator) Transform(newArtifacts []transformertypes if selectedBuildOption == dotnetutils.BUILD_IN_BASE_IMAGE { webConfig := WebTemplateConfig{ - BuildStageImageTag: dotnet.DefaultBaseImageVersion, + BuildStageImageTag: t.getImageTagFromVersion(dotnet.DefaultBaseImageVersion), IncludeBuildStage: true, IncludeRunStage: false, BuildContainerName: imageToCopyFrom, @@ -378,7 +378,7 @@ func (t *WinWebAppDockerfileGenerator) Transform(newArtifacts []transformertypes webConfig := WebTemplateConfig{ Ports: selectedPorts, - BuildStageImageTag: dotnet.DefaultBaseImageVersion, + BuildStageImageTag: t.getImageTagFromVersion(targetFrameworkVersion), IncludeBuildStage: selectedBuildOption == dotnetutils.BUILD_IN_EVERY_IMAGE, IncludeRunStage: true, BuildContainerName: imageToCopyFrom, diff --git a/types/source/dotnet/csproj.go b/types/source/dotnet/csproj.go index 0f5d60609..5e5b4b21b 100644 --- a/types/source/dotnet/csproj.go +++ b/types/source/dotnet/csproj.go @@ -23,8 +23,8 @@ import ( ) var ( - // Version4 is the framework version pattern - Version4 = regexp.MustCompile("v4") + // Version4And3_5 is the regex to match against specific Dot Net framework versions + Version4And3_5 = regexp.MustCompile(`(v4|v3\.5)`) // WebLib is the key library used in web applications WebLib = regexp.MustCompile(`^System\.Web`) // AspNetWebLib is the key library used in asp net web applications