Skip to content

Commit

Permalink
修复获取不到3.x版本号的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liesauer committed Oct 31, 2019
1 parent 97ba2e3 commit 7823bda
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion NetCoreBeautyGlobalTool/NetCoreBeautyGlobalTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ToolCommandName>ncbeauty</ToolCommandName>
<PackageOutputPath>.nupkg</PackageOutputPath>

<Version>1.1.2</Version>
<Version>1.1.3</Version>

<Authors>LiesAuer</Authors>
<Description>Move a .NET Core app runtime components and dependencies into a sub-directory and make it beauty.</Description>
Expand Down
2 changes: 1 addition & 1 deletion NetCoreBeautyNuget/NetCoreBeauty.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>nulastudio.NetCoreBeauty</id>
<description>Move a .NET Core app runtime components and dependencies into a sub-directory and make it beauty.</description>
<version>1.1.2</version>
<version>1.1.3</version>
<authors>LiesAuer</authors>
<owners>nulastudio</owners>
<projectUrl>https://github.com/nulastudio/NetCoreBeauty</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion NetCoreBeautyNugetTest/NetCoreBeautyTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nulastudio.NetCoreBeauty" Version="1.1.2" />
<PackageReference Include="nulastudio.NetCoreBeauty" Version="1.1.3" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ your `*.csproj` should be similar like this
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nulastudio.NetCoreBeauty" Version="1.1.2" />
<PackageReference Include="nulastudio.NetCoreBeauty" />
</ItemGroup>

</Project>
Expand Down
23 changes: 19 additions & 4 deletions src/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7823bda

Please sign in to comment.