diff --git a/NetCoreBeautyGlobalTool/NetCoreBeautyGlobalTool.csproj b/NetCoreBeautyGlobalTool/NetCoreBeautyGlobalTool.csproj index d2c6f5d..29b4f92 100644 --- a/NetCoreBeautyGlobalTool/NetCoreBeautyGlobalTool.csproj +++ b/NetCoreBeautyGlobalTool/NetCoreBeautyGlobalTool.csproj @@ -9,7 +9,7 @@ ncbeauty .nupkg - 1.1.2 + 1.1.3 LiesAuer Move a .NET Core app runtime components and dependencies into a sub-directory and make it beauty. diff --git a/NetCoreBeautyNuget/NetCoreBeauty.nuspec b/NetCoreBeautyNuget/NetCoreBeauty.nuspec index 21188d4..d0b3d16 100644 --- a/NetCoreBeautyNuget/NetCoreBeauty.nuspec +++ b/NetCoreBeautyNuget/NetCoreBeauty.nuspec @@ -3,7 +3,7 @@ nulastudio.NetCoreBeauty Move a .NET Core app runtime components and dependencies into a sub-directory and make it beauty. - 1.1.2 + 1.1.3 LiesAuer nulastudio https://github.com/nulastudio/NetCoreBeauty diff --git a/NetCoreBeautyNugetTest/NetCoreBeautyTest.csproj b/NetCoreBeautyNugetTest/NetCoreBeautyTest.csproj index 754c423..a5f0a86 100644 --- a/NetCoreBeautyNugetTest/NetCoreBeautyTest.csproj +++ b/NetCoreBeautyNugetTest/NetCoreBeautyTest.csproj @@ -17,7 +17,7 @@ - + diff --git a/README.md b/README.md index f3102e4..5a577cd 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ your `*.csproj` should be similar like this - + diff --git a/src/manager/manager.go b/src/manager/manager.go index 7172f93..9f199ca 100644 --- a/src/manager/manager.go +++ b/src/manager/manager.go @@ -430,11 +430,26 @@ func FixDeps(deps string) ([]string, string, string) { for _, target := range targets { for targetName, depsObj := range target.(map[string]interface{}) { // 解析出fxr信息 - if strings.HasPrefix(targetName, "runtime") && strings.Contains(targetName, "Microsoft.NETCore.DotNetHostResolver") { - regex, _ := regexp.Compile("^runtime\\.([\\w-]+)\\.Microsoft\\.NETCore\\.DotNetHostResolver\\/([\\d\\.]+)$") + if strings.HasPrefix(targetName, "runtime") && + (strings.Contains(targetName, "Microsoft.NETCore.DotNetHostResolver") || + strings.Contains(targetName, "Microsoft.NETCore.App.Runtime")) { + // 2.x + regex, _ := regexp.Compile("^runtime\\.([\\w\\-]+)\\.Microsoft\\.NETCore\\.DotNetHostResolver\\/([\\w\\-\\.]+)$") matches := regex.FindStringSubmatch(targetName) - rid = matches[1] - fxrVersion = matches[2] + if len(matches) == 0 { + // 3.0.x + regex, _ = regexp.Compile("^runtimepack\\.runtime\\.([\\w\\-]+)\\.Microsoft\\.NETCore\\.DotNetHostResolver\\/([\\w\\-\\.]+)$") + matches = regex.FindStringSubmatch(targetName) + if len(matches) == 0 { + // 3.1.x + regex, _ = regexp.Compile("^runtimepack\\.Microsoft\\.NETCore\\.App\\.Runtime\\.([\\w\\-]+)\\/([\\w\\-\\.]+)$") + matches = regex.FindStringSubmatch(targetName) + } + } + if len(matches) == 3 { + rid = matches[1] + fxrVersion = matches[2] + } log.LogInfo(fmt.Sprintf("fxr v%s/%s detected in %s", fxrVersion, rid, deps)) } if depsObj != nil {