实例介绍
《.NET端口助手:加速应用向Linux迁移的工具》
.NET端口助手提供了独立工具和Visual Studio IDE扩展两种方式,帮助开发者扫描.NET Framework应用程序,并生成.NET兼容性评估报告,从而加快应用程序向Linux的迁移进程。该工具能够快速识别与.NET不兼容的问题,找到已知的替代方案,并生成详细的兼容性评估报告,减少了手动现代化应用程序到Linux的工作量。
要开始使用.NET端口助手,请将PortingAssistant.Client SDK包添加到您的项目中,然后按照以下示例代码集成到您的应用程序中,以分析和迁移应用:
var solutionPath = "/user/projects/TestProject/TestProject.sln"; var outputPath = "/tmp/"; var configuration = new PortingAssistantConfiguration(); var portingAssistantBuilder = PortingAssistantBuilder.Build(configuration, logConfig => logConfig.AddConsole()); var portingAssistantClient = portingAssistantBuilder.GetPortingAssistant(); var reportExporter = portingAssistantBuilder.GetReportExporter(); var analyzerSettings = new AnalyzerSettings { TargetFramework = "netcoreapp3.1", }; var analyzeResults = await portingAssistantClient.AnalyzeSolutionAsync(solutionPath, analyzerSettings); reportExporter.GenerateJsonReport(analyzeResults, outputPath); var filteredProjects = new List<string> {"projectname1", "projectname2"}; var projects = analyzeResults.SolutionDetails.Projects.Where(p => !filteredProjects.Contains(p.ProjectName)).ToList(); var PortingProjectResults = analyzeResults.ProjectAnalysisResults .Where(project => !filteredProjects.Contains(project.ProjectName)); var portingRequest = new PortingRequest { Projects = projects, SolutionPath = solutionPath, TargetFramework = analyzerSettings.TargetFramework, IncludeCodeFix = true }; var portingResults = portingAssistantClient.ApplyPortingChanges(portingRequest); reportExporter.GenerateJsonReport(portingResults, solutionPath, outputPath);
【实例截图】
【核心代码】
文件清单
└── porting-assistant-dotnet-client-2e8bc947fffc88311ce461e075a3d7b0d10d2a82
├── benchmark
│ └── tags
│ └── static-baseline
│ └── BenchmarkDotNet.Artifacts
│ └── results
│ └── TuxNet.Benchmarking.Wrapper.PA_Client_Benchmark-report.csv
├── benchmark-targets.json
├── CODEOWNERS
├── CONTRIBUTING.md
├── Directory.Build.props
├── hooks
│ └── pre-commit
├── LICENSE
├── logo.png
├── NOTICE
├── NuGet.Config
├── nuspec.props
├── PortingAssistant.Client.sln
├── README.md
├── scripts
│ ├── coverlet.runsettings
│ └── verify-cov.sh
├── sleet.json
├── src
│ ├── PortingAssistant.Client
│ │ ├── PortingAssistantCLI.cs
│ │ ├── PortingAssistant.Client.CLI.csproj
│ │ ├── PortingAssistantTelemetryConfig.json
│ │ └── Program.cs
│ ├── PortingAssistant.Client.Analysis
│ │ ├── AnalysisHandler.cs
│ │ ├── CacheService.cs
│ │ ├── IAnalysisHandler.cs
│ │ ├── ICacheService.cs
│ │ ├── Mappers
│ │ │ ├── CompatibilityResultMapper.cs
│ │ │ ├── PackageAnalysisResultsMapper.cs
│ │ │ ├── PackageVersionPairMapper.cs
│ │ │ └── RecommandationMapper.cs
│ │ ├── packages.lock.json
│ │ ├── PortingAssistant.Client.Analysis.csproj
│ │ └── Utils
│ │ ├── ApiCompatiblity.cs
│ │ ├── CodeEntityModelToCodeEntities.cs
│ │ ├── CompatibilityCheckerHelper.cs
│ │ ├── NugetVersionExtensions.cs
│ │ ├── NugetVersionHelper.cs
│ │ ├── PackageCompatibility.cs
│ │ └── ProjectActionsToRecommendedActions.cs
│ ├── PortingAssistant.Client.Client
│ │ ├── DependencyInjection.cs
│ │ ├── FileParser
│ │ │ ├── GitConfigFileParser.cs
│ │ │ ├── ProjectFileParser.cs
│ │ │ └── SolutionFileParser.cs
│ │ ├── IPortingAssistantClient.cs
│ │ ├── Model
│ │ │ └── ProjectApiAnalysisResult.cs
│ │ ├── PortingAssistantBuilder.cs
│ │ ├── PortingAssistant.Client.Client.csproj
│ │ ├── PortingAssistantClient.cs
│ │ ├── Reports
│ │ │ ├── IReportExporter.cs
│ │ │ └── ReportExporter.cs
│ │ └── Utils
│ │ └── HashUtils.cs
│ ├── PortingAssistant.Client.Common
│ │ ├── Exception
│ │ │ ├── ExceptionMessage.cs
│ │ │ ├── InnerException
│ │ │ │ ├── NamespaceNotFoundException.cs
│ │ │ │ ├── PackageDownloadMismatchException.cs
│ │ │ │ ├── PackageNotFoundException.cs
│ │ │ │ └── PackageSourceNotFoundException.cs
│ │ │ ├── PortingAssistantClientException.cs
│ │ │ └── PortingAssistantException.cs
│ │ ├── Model
│ │ │ ├── AnalyzerSettings.cs
│ │ │ ├── ApiAnalysisResult.cs
│ │ │ ├── ApiRecommedation.cs
│ │ │ ├── CodeEntityCompatibilityResult.cs
│ │ │ ├── CodeEntityDetails.cs
│ │ │ ├── CodeEntityType.cs
│ │ │ ├── Compatibility.cs
│ │ │ ├── CompatibilityResult.cs
│ │ │ ├── DataStoreSettings.cs
│ │ │ ├── InternalNugetCompatibilityResult.cs
│ │ │ ├── NuGetServerSettings.cs
│ │ │ ├── PackageAnalysisResult.cs
│ │ │ ├── PackageDetails.cs
│ │ │ ├── PackageDetailsWithApiIndices.cs
│ │ │ ├── PackageRecommendation.cs
│ │ │ ├── PackageSourceType.cs
│ │ │ ├── PackageVersionPair.cs
│ │ │ ├── PortingAction.cs
│ │ │ ├── PortingAssistantConfiguration.cs
│ │ │ ├── PortingRequest.cs
│ │ │ ├── PortingResult.cs
│ │ │ ├── ProjectAnalysisResult.cs
│ │ │ ├── ProjectCompatibilityResult.cs
│ │ │ ├── ProjectDetails.cs
│ │ │ ├── ProjectReference.cs
│ │ │ ├── RecommendationDetails.cs
│ │ │ ├── Recommendations.cs
│ │ │ ├── RecommendedAction.cs
│ │ │ ├── RecommendedActionType.cs
│ │ │ ├── Schema.cs
│ │ │ ├── SolutionAnalysisResult.cs
│ │ │ ├── SolutionDetails.cs
│ │ │ ├── SourceFileAnalysisResult.cs
│ │ │ ├── TextSpan.cs
│ │ │ └── VisualStudioVersion.cs
│ │ ├── PortingAssistant.Client.Common.csproj
│ │ └── Utils
│ │ ├── AnalysisUtils.cs
│ │ ├── FileSystemAccess.cs
│ │ ├── FileSystem.cs
│ │ ├── IFileSystem.cs
│ │ ├── Logging.cs
│ │ ├── MemoryUtils.cs
│ │ └── XDocumentExtensions.cs
│ ├── PortingAssistant.Client.NuGet
│ │ ├── Checkers
│ │ │ ├── ExternalCompatibilityChecker.cs
│ │ │ ├── ExternalPackagesCompatibilityChecker.cs
│ │ │ ├── InternalPackagesCompatibilityChecker.cs
│ │ │ ├── PortabilityAnalyzerCompatibilityChecker.cs
│ │ │ └── SdkCompatibilityChecker.cs
│ │ ├── Interfaces
│ │ │ ├── ICompatibilityChecker.cs
│ │ │ ├── IHttpService.cs
│ │ │ ├── IPortingAssistantNuGetHandler.cs
│ │ │ └── IPortingAssistantRecommendationHandler.cs
│ │ ├── InternalNuget
│ │ │ ├── IPortingAssistantInternalNuGetCompatibilityHandler.cs
│ │ │ └── PortingAssistantInternalNuGetCompatibilityHandler.cs
│ │ ├── PortingAssistant.Client.NuGet.csproj
│ │ ├── PortingAssistantNuGetHandler.cs
│ │ ├── PortingAssistantRecommendationHandler.cs
│ │ └── Utils
│ │ └── HttpService.cs
│ ├── PortingAssistant.Client.Porting
│ │ ├── IPortingHandler.cs
│ │ ├── packages.lock.json
│ │ ├── PortingAssistant.Client.Porting.csproj
│ │ ├── PortingHandler.cs
│ │ └── PortingProjectFile
│ │ ├── IPortingProjectFileHandler.cs
│ │ └── PortingProjectFileHandler.cs
│ ├── PortingAssistant.Client.Telemetry
│ │ ├── ITelemetryClient.cs
│ │ ├── Model
│ │ │ ├── APIMetrics.cs
│ │ │ ├── MetricsBase.cs
│ │ │ ├── MetricsType.cs
│ │ │ ├── NugetMetrics.cs
│ │ │ ├── ProjectMetrics.cs
│ │ │ └── SolutionMetrics.cs
│ │ ├── packages.lock.json
│ │ ├── PortingAssistant.Client.Telemetry.csproj
│ │ ├── TelemetryClientConfig.cs
│ │ ├── TelemetryClient.cs
│ │ ├── TelemetryCollector.cs
│ │ ├── TelemetryConfiguration.cs
│ │ ├── TelemetryRequest.cs
│ │ └── Uploader.cs
│ ├── PortingAssistant.Compatibility.Common
│ │ ├── Interface
│ │ │ ├── ICacheManager.cs
│ │ │ ├── ICompatibilityChecker.cs
│ │ │ ├── ICompatibilityCheckerHandler.cs
│ │ │ ├── ICompatibilityCheckerNuGetHandler.cs
│ │ │ ├── ICompatibilityCheckerRecommendationActionHandler.cs
│ │ │ ├── ICompatibilityCheckerRecommendationHandler.cs
│ │ │ ├── IHttpService.cs
│ │ │ └── IRegionalDatastoreService.cs
│ │ ├── Model
│ │ │ ├── AnalysisResult.cs
│ │ │ ├── ApiEntity.cs
│ │ │ ├── CodeEntityType.cs
│ │ │ ├── CompatibilityCheckerConfiguration.cs
│ │ │ ├── CompatibilityCheckerRequest.cs
│ │ │ ├── CompatibilityCheckerResponse.cs
│ │ │ ├── Compatibility.cs
│ │ │ ├── CompatibilityResult.cs
│ │ │ ├── Exception
│ │ │ │ ├── ExceptionMessage.cs
│ │ │ │ ├── NamespaceNotFoundException.cs
│ │ │ │ ├── PackageDownloadMismatchException.cs
│ │ │ │ ├── PackageNotFoundException.cs
│ │ │ │ └── PortingAssistantClientException.cs
│ │ │ ├── PackageAnalysisResult.cs
│ │ │ ├── PackageApiDetails.cs
│ │ │ ├── PackageDetailsWithApiIndices.cs
│ │ │ ├── PackageSourceType.cs
│ │ │ ├── PackageVersionPair.cs
│ │ │ ├── RecommendationActionFileDetails.cs
│ │ │ ├── RecommendationDetails.cs
│ │ │ └── Recommendations.cs
│ │ ├── PortingAssistant.Compatibility.Common.csproj
│ │ └── Utils
│ │ ├── ApiCompatiblity.cs
│ │ ├── Constants.cs
│ │ ├── HttpService.cs
│ │ ├── NugetVersionExtensions.cs
│ │ ├── NugetVersionHelper.cs
│ │ ├── PackageCompatibility.cs
│ │ └── RegionalDatastoreService.cs
│ └── PortingAssistant.Compatibility.Core
│ ├── CacheManager.cs
│ ├── Checkers
│ │ ├── ExternalCompatibilityChecker.cs
│ │ ├── NugetCompatibilityChecker.cs
│ │ ├── PortabilityAnalyzerCompatibilityChecker.cs
│ │ └── SdkCompatibilityChecker.cs
│ ├── CompatibilityCheckerBuilder.cs
│ ├── CompatibilityCheckerHandler.cs
│ ├── CompatibilityCheckerNuGetHandler.cs
│ ├── CompatibilityCheckerRecommendationActionHandler.cs
│ ├── CompatibilityCheckerRecommendationHandler.cs
│ └── PortingAssistant.Compatibility.Core.csproj
├── tests
│ ├── PortingAssistant.Client.IntegrationTests
│ │ ├── AssessOptionsTest.cs
│ │ ├── CorrectnessTestBase.cs
│ │ ├── PortingAssistant.Client.IntegrationTests.csproj
│ │ ├── RunAnalysisCorrectnessWithDotNetFramework.cs
│ │ ├── RunPortingCorrectnessWithDotNetFramework.cs
│ │ ├── RunPortingWithWebFormFramework.cs
│ │ ├── RunSchemaVersionApi.cs
│ │ ├── RunWithDotNetCoreFrameowrk.cs
│ │ ├── RunWithDotNetFramework.cs
│ │ ├── SolutionAnalyzerTests.cs
│ │ ├── TestProjects
│ │ │ ├── eShopOnBlazor-ported.zip
│ │ │ ├── eShopOnBlazor.zip
│ │ │ ├── Miniblog.Core-master.zip
│ │ │ ├── NetFrameworkExample-analyze
│ │ │ │ ├── NetFrameworkExample-api-analysis.json
│ │ │ │ └── NetFrameworkExample-package-analysis.json
│ │ │ ├── NetFrameworkExample-ported.zip
│ │ │ ├── NetFrameworkExample.zip
│ │ │ ├── Schemas
│ │ │ │ ├── api-analysis-schema.json
│ │ │ │ └── package-analysis-schema.json
│ │ │ ├── TestNet31Empty.zip
│ │ │ └── VBWebApi.zip
│ │ └── TestUtils
│ │ ├── CacheUtils.cs
│ │ ├── DirectoryUtils.cs
│ │ └── JsonUtils.cs
│ ├── PortingAssistant.Client.UnitTests
│ │ ├── GitConfigFileParserTest.cs
│ │ ├── HashUtilsTest.cs
│ │ ├── MemoryUtilsTest.cs
│ │ ├── MockInvocationExpressionModel.cs
│ │ ├── NUnitLogger.cs
│ │ ├── PortingAssistantAnalysisHandlerTest.cs
│ │ ├── PortingAssistantClientTest.cs
│ │ ├── PortingAssistant.Client.UnitTests.csproj
│ │ ├── PortingAssistantNugetHandlerTest.cs
│ │ ├── PortingAssistantPortingTest.cs
│ │ ├── PortingAssistantProjectFileParserTest.cs
│ │ ├── PortingAssistantRecommendationTest.cs
│ │ ├── PortingAssistantTelemetryCollectorTest.cs
│ │ ├── ReportExporterTest.cs
│ │ ├── SolutionFileParserTest.cs
│ │ ├── TelemetryClientFactoryTest.cs
│ │ ├── TelemetryClientTest.cs
│ │ ├── TelemetryConfigurationTest.cs
│ │ ├── TestProjects
│ │ │ └── mvcmusicstore.zip
│ │ ├── TestXml
│ │ │ ├── ProjectWithPackagesConfig
│ │ │ │ ├── packages.config
│ │ │ │ └── ProjectWithPackagesConfig.csproj
│ │ │ ├── ProjectWithReference
│ │ │ │ └── ProjectWithReference.csproj
│ │ │ ├── SolutionWithApi
│ │ │ │ ├── SolutionWithApi.sln
│ │ │ │ └── testproject
│ │ │ │ ├── Program.cs
│ │ │ │ └── testproject.csproj
│ │ │ ├── SolutionWithFailedContent
│ │ │ │ ├── packages.config
│ │ │ │ ├── ProjectInWrongDirectory.csproj
│ │ │ │ ├── SolutionWithFailedContent.sln
│ │ │ │ └── test
│ │ │ │ ├── ProjectWithCorruptContent.csproj
│ │ │ │ └── ProjectWithCorruptPackageVersion.csproj
│ │ │ ├── SolutionWithNugetConfigFile
│ │ │ │ ├── nuget.config
│ │ │ │ ├── SolutionWithNugetConfigFile.sln
│ │ │ │ ├── Test1
│ │ │ │ │ └── Test1.csproj
│ │ │ │ └── Test2
│ │ │ │ └── Test2.csproj
│ │ │ ├── SolutionWithProjects
│ │ │ │ ├── Nop.Core
│ │ │ │ │ ├── Nop.Core.csproj
│ │ │ │ │ └── packages.config
│ │ │ │ ├── PortingAssistantApi
│ │ │ │ │ └── PortingAssistantApi.csproj
│ │ │ │ ├── PortingAssistantApiElectron
│ │ │ │ │ ├── packages.config
│ │ │ │ │ └── PortingAssistantApiElectron.csproj
│ │ │ │ ├── PortingAssistantAssessment
│ │ │ │ │ └── PortingAssistantAssessment.csproj
│ │ │ │ ├── PortingAssistantCache
│ │ │ │ │ ├── packages.config
│ │ │ │ │ └── PortingAssistantCache.csproj
│ │ │ │ └── SolutionWithProjects.sln
│ │ │ ├── TestNugetRepository
│ │ │ │ ├── newtonsoft.json.12.0.3.nupkg
│ │ │ │ └── newtonsoft.json.6.0.1.nupkg
│ │ │ ├── TestPorting
│ │ │ │ ├── corrupt
│ │ │ │ │ ├── CorruptProject.csproj
│ │ │ │ │ ├── CorruptSolution.sln
│ │ │ │ │ └── packages.config
│ │ │ │ └── src
│ │ │ │ ├── Libraries
│ │ │ │ │ └── Nop.Core
│ │ │ │ │ ├── app.config
│ │ │ │ │ ├── Nop.Core.csproj
│ │ │ │ │ ├── packages.config
│ │ │ │ │ └── Program.cs
│ │ │ │ └── NopCommerce.sln
│ │ │ └── VBSolutionWithApi
│ │ │ ├── VBSolutionWithApi.sln
│ │ │ └── VBtestproject
│ │ │ ├── Program.vb
│ │ │ └── VBtestproject.vbproj
│ │ └── UploaderTest.cs
│ └── PortingAssistant.Compatibility.Core.Tests
│ ├── PortingAssistant.Compatibility.Core.Tests.csproj
│ └── UnitTests
│ ├── ApiCompatibilityTest.cs
│ ├── NugetHandlerTest.cs
│ ├── NugetVersionExtensionTest.cs
│ ├── NugetVersionHelperTest.cs
│ ├── RecommendationActionTest.cs
│ └── RecommendationTest.cs
├── THIRD-PARTY
└── version.json
73 directories, 273 files
标签:
相关软件
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论