private static (IProjectRootElement baselineRootElement, IProjectRootElement convertedRootElement) GetRootElementsForComparison(string projectToConvertPath, string projectBaselinePath, string targetTFM, bool forceWeb)
        {
            var conversionLoader    = new MSBuildConversionWorkspaceLoader(projectToConvertPath, MSBuildConversionWorkspaceType.Project);
            var conversionWorkspace = conversionLoader.LoadWorkspace(projectToConvertPath, noBackup: true, targetTFM, false, forceWeb);

            var baselineLoader      = new MSBuildConversionWorkspaceLoader(projectBaselinePath, MSBuildConversionWorkspaceType.Project);
            var baselineRootElement = baselineLoader.GetRootElementFromProjectFile(projectBaselinePath);

            var item                 = conversionWorkspace.WorkspaceItems.Single();
            var converter            = new Converter(item.UnconfiguredProject, item.SdkBaselineProject, item.ProjectRootElement, noBackup: false);
            var convertedRootElement = converter.ConvertProjectFile();

            return(baselineRootElement, convertedRootElement);
        }
Beispiel #2
0
        private static (IProjectRootElement baselineRootElement, IProjectRootElement convertedRootElement) GetRootElementsForComparison(string projectToConvertPath, string projectBaselinePath)
        {
            var conversionLoader    = new MSBuildConversionWorkspaceLoader(projectToConvertPath, MSBuildConversionWorkspaceType.Project);
            var conversionWorkspace = conversionLoader.LoadWorkspace(projectToConvertPath, noBackup: true);

            var baselineLoader      = new MSBuildConversionWorkspaceLoader(projectBaselinePath, MSBuildConversionWorkspaceType.Project);
            var baselineRootElement = baselineLoader.GetRootElementFromProjectFile(projectBaselinePath);

            var item                 = conversionWorkspace.WorkspaceItems.Single();
            var converter            = new Converter(item.UnconfiguredProject, item.SdkBaselineProject, item.ProjectRootElement);
            var convertedRootElement = converter.ConvertProjectFile("netcoreapp3.1", keepCurrentTfm: false, usePreviewSDK: false);

            return(baselineRootElement, convertedRootElement);
        }