コード例 #1
0
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;
            JObject frameworks        = (JObject)projectJsonObject["frameworks"];

            //_oldFrameworks = frameworks.DeepClone();

            // dnx451
            RenameFramework(frameworks, "dnx", "net452");
            RenameFramework(frameworks, "dnx45", "net452");
            RenameFramework(frameworks, "dnx451", "net452");
            RenameFramework(frameworks, "dnx452", "net452");

            // dnxCore
            var dnxCore50 = frameworks.Property("dnxcore50");

            if (dnxCore50 != null)
            {
                dnxCore50.Remove();

                var projWrapper = fileUpgradeContext.ToProjectJsonWrapper();
                var projType    = projWrapper.GetProjectType();
                if (projType == ProjectType.Library)
                {
                    projWrapper.AddNetStandardFramework(NetStandardLibraryVersion, NetStandardTfm);
                }
                else if (projType == ProjectType.Application)
                {
                    projWrapper.AddNetCoreAppFramework(NetCoreAppVersion, NetCoreAppTfmName);
                }
            }
        }
コード例 #2
0
        protected override JObject GetPackagesObject(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;
            JObject tools             = (JObject)(projectJsonObject["tools"] ?? projectJsonObject["commands"] ?? projectJsonObject.GetOrAddProperty("tools", null));

            return(tools);
        }
コード例 #3
0
 public void Apply(IProjectUpgradeContext fileUpgradeContext)
 {
     if (fileUpgradeContext.VsProjectFile != null)
     {
         fileUpgradeContext.VsProjectFile.UpdatePropertyValue("BaseIntermediateOutputPath", ".\\obj");
     }
 }
コード例 #4
0
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject  = fileUpgradeContext.ProjectJsonObject;
            JObject compilationOptions = (JObject)projectJsonObject["compilationOptions"];

            if (compilationOptions != null)
            {
                compilationOptions.Rename("buildOptions");
                // compilationOptions = new JObject();
                // projectJsonObject["compilationOptions"] = compilationOptions;
            }

            var buildOptions = projectJsonObject["buildOptions"];

            if (buildOptions == null)
            {
                buildOptions = new JObject();
                projectJsonObject["buildOptions"] = buildOptions;
            }

            buildOptions["preserveCompilationContext"] = true;

            foreach (var item in ((JObject)projectJsonObject["frameworks"]).Properties())
            {
                var tfmCompilationOptions = ((JObject)item.Value).Property("compilationOptions");
                if (tfmCompilationOptions != null)
                {
                    tfmCompilationOptions.Replace(new JProperty("buildOptions", tfmCompilationOptions.Value));
                }
            }
        }
コード例 #5
0
 public void Apply(IProjectUpgradeContext fileUpgradeContext)
 {
     if (fileUpgradeContext.VsProjectFile != null)
     {
         fileUpgradeContext.VsProjectFile.AddPropertyValue("Globals", "TargetFrameworkVersion", _targetFramework);
     }
 }
 public void Apply(IProjectUpgradeContext fileUpgradeContext)
 {
     if (fileUpgradeContext.VsProjectFile != null)
     {
         bool isWebProject = fileUpgradeContext.ToProjectJsonWrapper().IsMvcProject();
         UpgradeDnxProjectToDotNet(fileUpgradeContext.VsProjectFile, isWebProject);
     }
 }
コード例 #7
0
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;

            foreach (var item in _packOptionProps)
            {
                MoveToPackOptions(projectJsonObject, item);
            }
        }
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            var projectWrapper = fileUpgradeContext.ToProjectJsonWrapper();
            var projType       = projectWrapper.GetProjectType();

            if (projType == ProjectType.Library)
            {
                projectWrapper.AddNetStandardFramework(_netStandardLibraryVersion, _netStandardTfm);
            }
        }
コード例 #9
0
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;
            JObject commands          = (JObject)projectJsonObject["commands"];

            if (commands != null)
            {
                commands.Rename("tools");
            }
        }
コード例 #10
0
        protected override JObject GetPackagesObject(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;
            var     dependencies      = projectJsonObject.GetOrAddProperty("dependencies", null);

            if (dependencies == null)
            {
                Debugger.Break();
            }
            // JObject dependencies = (JObject)projectJsonObject["dependencies"];
            return(dependencies);
        }
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            var projectJsonWrapper = fileUpgradeContext.ToProjectJsonWrapper();

            if (projectJsonWrapper.IsMvcProject())
            {
                var items = new JArray();
                items.Add("Views/**");

                projectJsonWrapper.IncludeInCopyToOutput(items);
            }
        }
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;
            JObject frameworks        = (JObject)projectJsonObject["frameworks"];

            var projWrapper = fileUpgradeContext.ToProjectJsonWrapper();
            var projType    = projWrapper.GetProjectType();

            if (projType == ProjectType.Application)
            {
                if (!projWrapper.HasFramework(_netCoreAppTfmName))
                {
                    projWrapper.AddNetCoreAppFramework(_netCoreAppVersion, _netCoreAppTfmName);
                }
            }
        }
コード例 #13
0
        public void Apply(IProjectUpgradeContext upgradeContext)
        {
            JObject launchSettings = upgradeContext.LaunchSettingsObject;

            if (launchSettings != null)
            {
                JObject profiles = launchSettings.GetOrAddProperty("profiles", null);
                // replace Hosting:Environment environment variable.
                foreach (var prop in profiles.Properties())
                {
                    var profileProp = (JObject)profiles[prop.Name];

                    var envVariables = profileProp["environmentVariables"];
                    var oldHosting   = envVariables?["Hosting:Environment"];
                    oldHosting?.Rename("ASPNETCORE_ENVIRONMENT");

                    // remove sdk version
                    var sdkVersion = profileProp.Property("sdkVersion");
                    if (sdkVersion != null)
                    {
                        sdkVersion.Remove();
                    }

                    // profileProp.prop["sdkVersion"].Remove();
                    // sdkVersion?.Remove();
                }

                var webProfile = profiles["web"];
                if (webProfile != null)
                {
                    string projName = upgradeContext.ProjectName();
                    webProfile.Rename(projName);

                    // ensure command name is set to project
                    webProfile["commandName"]   = "Project";
                    webProfile["launchBrowser"] = true;
                    //  webProfile["launchUrl"] = true;
                    //  var projectName =  .FullPath
                }

                // set application url in iisSettings?
                JObject iisSettings        = launchSettings.GetOrAddProperty("iisSettings", null);
                JObject iisExpressSettings = iisSettings.GetOrAddProperty("iisExpress", null);
                iisExpressSettings["applicationUrl"] = "http://localhost:50000/";
            }
        }
コード例 #14
0
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;
            JObject dependencies      = (JObject)projectJsonObject["dependencies"];

            var dependenciesToUpdate = new List <JProperty>();

            foreach (var dependencyProp in dependencies.Properties())
            {
                if (_dependencyFilter(ReleaseVersion, dependencyProp))
                {
                    dependenciesToUpdate.Add(dependencyProp);
                }
            }

            foreach (var dependencyForUpdate in dependenciesToUpdate)
            {
                _updateDependencyCallback(ReleaseVersion, dependencies, dependencyForUpdate);
            }
        }
コード例 #15
0
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;

            // get appsettings json files.
            var appSettingsFileNames =
                fileUpgradeContext.JsonFiles.Where(a => a.Name().ToLowerInvariant().StartsWith("appsettings")).ToArray();
            // for each one, include it in the publishOptions and the copytooutput.

            JArray copyToOutputArray = new JArray();

            foreach (var appSettingsFile in appSettingsFileNames)
            {
                copyToOutputArray.Add(appSettingsFile.Name());
            }

            var projectJsonWrapper = fileUpgradeContext.ToProjectJsonWrapper();

            projectJsonWrapper.IncludeInCopyToOutput(copyToOutputArray);
        }
コード例 #16
0
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;

            //  JArray exclude = (JArray)projectJsonObject["exclude"];
            // JArray publishExclude = (JArray)projectJsonObject["publishExclude"];

            projectJsonObject.Remove("exclude");
            projectJsonObject.Remove("publishExclude");

            JArray includeArray = new JArray();

            if (fileUpgradeContext.ToProjectJsonWrapper().IsMvcProject())
            {
                // add default publishing options
                includeArray.Add("wwwroot");
                includeArray.Add("web.config");
            }

            var appSettingsFileNames = fileUpgradeContext.JsonFiles.Where(a => a.Name().ToLowerInvariant().StartsWith("appsettings")).ToArray();

            foreach (var item in appSettingsFileNames)
            {
                includeArray.Add(item.Name());
            }

            //includeArray.Add("Views");
            //   includeArray.Add("appSettings.json");

            var publishOptions = new JObject(new JProperty("include", includeArray));

            projectJsonObject["publishOptions"] = publishOptions;

            //              "publishOptions": {
            //                  "include": [
            //                    "wwwroot",
            //                    "appsettings.json",
            //                    "web.config"
            //]
            //  },
        }
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject packagesObject = GetPackagesObject(fileUpgradeContext);

            foreach (var targetPackage in _targetPackages)
            {
                switch (targetPackage.MigrationAction)
                {
                case PackageMigrationAction.Remove:
                    RemovePackage(targetPackage, packagesObject);
                    continue;

                case PackageMigrationAction.Update:
                    UpdatePackage(targetPackage, packagesObject);
                    continue;

                case PackageMigrationAction.AddOrUpdate:
                    AddOrUpdatePackage(targetPackage, packagesObject);
                    continue;
                }
            }
        }
        public List <DependencyPackageMigrationInfo> GetPackageMigrations(ToolingVersion targetToolingVersion, IProjectUpgradeContext projectContext)
        {
            var    list           = new List <DependencyPackageMigrationInfo>();
            string toolingVersion = ToolingVersion.Preview1.ToString().ToLowerInvariant();


            // ef packages..
            var package = new DependencyPackageMigrationInfo("Microsoft.EntityFrameworkCore.SqlServer", "1.0.0-rc2-final");

            package.OldNames.Add("EntityFramework.MicrosoftSqlServer");
            package.OldNames.Add("EntityFramework.SqlServer");
            list.Add(package);

            package = new DependencyPackageMigrationInfo("Microsoft.EntityFrameworkCore.SQLite", "1.0.0-rc2-final");
            package.OldNames.Add("EntityFramework.SQLite");
            list.Add(package);

            //package = new NuGetPackageMigrationInfo("NpgSql.EntityFrameworkCore.Postgres", "1.0.0-rc2-final");
            //package.OldNames.Add("EntityFramework7.Npgsql");
            //list.Add(package);

            package = new DependencyPackageMigrationInfo("EntityFrameworkCore.SqlServerCompact35", "1.0.0-rc2-final");
            package.OldNames.Add("EntityFramework.SqlServerCompact35");
            list.Add(package);

            package = new DependencyPackageMigrationInfo("EntityFrameworkCore.SqlServerCompact40", "1.0.0-rc2-final");
            package.OldNames.Add("EntityFramework.SqlServerCompact40");
            list.Add(package);

            package = new DependencyPackageMigrationInfo("Microsoft.EntityFrameworkCore.InMemory", "1.0.0-rc2-final");
            package.OldNames.Add("EntityFramework.InMemory");
            list.Add(package);

            //package = new NuGetPackageMigrationInfo("EntityFramework.IBMDataServer", "1.0.0-rc2-final");
            //package.OldNames.Add("EntityFramework.IBMDataServer");
            //list.Add(package);

            package      = new DependencyPackageMigrationInfo("Microsoft.EntityFrameworkCore.Tools", $"1.0.0-{toolingVersion}-final");
            package.Type = PackageType.Build;
            package.OldNames.Add("EntityFramework.Commands");
            list.Add(package);


            package = new DependencyPackageMigrationInfo("Microsoft.EntityFrameworkCore.SqlServer.Design", "1.0.0-rc2-final");
            package.OldNames.Add("EntityFramework.MicrosoftSqlServer.Design");
            list.Add(package);



            return(list);
        }
        public List <ToolPackageMigrationInfo> GetPackageMigrations(ToolingVersion targetToolingVersion, IProjectUpgradeContext projectContext)
        {
            var    list           = new List <ToolPackageMigrationInfo>();
            string toolingVersion = targetToolingVersion.ToString().ToLowerInvariant();

            // Updates the old web command if it is found, to be the new tool.
            var package = new ToolPackageMigrationInfo("Microsoft.AspNetCore.Server.IISIntegration.Tools", $"1.0.0-{toolingVersion}-final");

            package.OldNames.Add("web");
            package.Imports.Add("portable-net45+win8+dnxcore50");
            package.MigrationAction = PackageMigrationAction.Update;
            list.Add(package);


            // Adds / updates the user secrets tool - if the project.json has a userSecretsId present.
            if (projectContext.ProjectJsonObject["userSecretsId"] != null)
            {
                package = new ToolPackageMigrationInfo("Microsoft.Extensions.SecretManager.Tools", $"1.0.0-{toolingVersion}-final");
                package.Imports.Add("portable-net45+win8+dnxcore50");
                package.MigrationAction = PackageMigrationAction.AddOrUpdate;
                list.Add(package);
            }

            // Updates the old ef command if it is found, to be the new tool.
            package = new ToolPackageMigrationInfo("Microsoft.EntityFrameworkCore.Tools", $"1.0.0-{toolingVersion}-final");
            package.OldNames.Add("ef");
            package.Imports.Add("portable-net45+win8+dnxcore50");
            package.Imports.Add("portable-net45+win8");
            package.MigrationAction = PackageMigrationAction.Update;
            list.Add(package);


            // only add the razor tools tool if project allready references razor tools package as a dependency (either as new or old name) in case we havent updated it yet)
            if (projectContext.ToProjectJsonWrapper().HasDependency("Microsoft.AspNetCore.Razor.Tools") ||
                projectContext.ToProjectJsonWrapper().HasDependency("Microsoft.AspNet.Tooling.Razor"))
            {
                package = new ToolPackageMigrationInfo("Microsoft.AspNetCore.Razor.Tools", $"1.0.0-{toolingVersion}-final");
                package.Imports.Add("portable-net45+win8+dnxcore50");
                package.MigrationAction = PackageMigrationAction.AddOrUpdate;
                list.Add(package);
            }

            // only add the web code generation tools to the project if its a web project. We use a heuristic - if MVC is there as a dependency then its a web project.
            if (projectContext.ToProjectJsonWrapper().IsMvcProject())
            {
                package = new ToolPackageMigrationInfo("Microsoft.VisualStudio.Web.CodeGeneration.Tools", $"1.0.0-{toolingVersion}-final");
                package.Imports.Add("portable-net45+win8+dnxcore50");
                package.Imports.Add("portable-net45+win8");
                package.MigrationAction = PackageMigrationAction.AddOrUpdate;
                list.Add(package);
            }


            return(list);
        }
コード例 #20
0
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;

            MoveResourcesToBuild(projectJsonObject);
        }
        public List <DependencyPackageMigrationInfo> GetPackageMigrations(ToolingVersion targetToolingVersion, IProjectUpgradeContext projectContext)
        {
            var    list           = new List <DependencyPackageMigrationInfo>();
            string toolingVersion = ToolingVersion.Preview1.ToString().ToLowerInvariant();


            // file providers were renamed.
            var package = new DependencyPackageMigrationInfo("Microsoft.Extensions.FileProviders.Abstractions", "1.0.0-rc2-final");

            package.OldNames.Add("Microsoft.AspNet.FileProviders");
            package.MigrationAction = PackageMigrationAction.Update;
            list.Add(package);

            package = new DependencyPackageMigrationInfo("Microsoft.Extensions.FileProviders.Composite", "1.0.0-rc2-final");
            package.OldNames.Add("Microsoft.AspNet.FileProviders.Composite");
            package.MigrationAction = PackageMigrationAction.Update;
            list.Add(package);

            package = new DependencyPackageMigrationInfo("Microsoft.Extensions.FileProviders.Embedded", "1.0.0-rc2-final");
            package.OldNames.Add("Microsoft.AspNet.FileProviders.Embedded");
            package.MigrationAction = PackageMigrationAction.Update;
            list.Add(package);

            package = new DependencyPackageMigrationInfo("Microsoft.Extensions.FileProviders.Physical", "1.0.0-rc2-final");
            package.OldNames.Add("Microsoft.AspNet.FileProviders.Physical");
            package.MigrationAction = PackageMigrationAction.Update;
            list.Add(package);


            return(list);
        }
        public List <DependencyPackageMigrationInfo> GetPackageMigrations(ToolingVersion targetToolingVersion, IProjectUpgradeContext projectContext)
        {
            var    list           = new List <DependencyPackageMigrationInfo>();
            string toolingVersion = ToolingVersion.Preview1.ToString().ToLowerInvariant();

            // aspnet packages
            var package = new DependencyPackageMigrationInfo("Microsoft.AspNetCore.Identity.EntityFrameworkCore", "1.0.0-rc2-final");

            package.OldNames.Add("Microsoft.AspNet.Identity.EntityFramework");
            list.Add(package);

            package = new DependencyPackageMigrationInfo("Microsoft.AspNetCore.Server.IISIntegration", "1.0.0-rc2-final");
            package.OldNames.Add("Microsoft.AspNet.IISPlatformHandler");
            list.Add(package);

            package = new DependencyPackageMigrationInfo("Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore", "1.0.0-rc2-final");
            package.OldNames.Add("Microsoft.AspNet.Diagnostics.Entity");
            list.Add(package);


            package      = new DependencyPackageMigrationInfo("Microsoft.AspNetCore.Razor.Tools", $"1.0.0-{toolingVersion}-final");
            package.Type = PackageType.Build;
            package.OldNames.Add("Microsoft.AspNet.Tooling.Razor");
            list.Add(package);

            var projectWrapper = projectContext.ToProjectJsonWrapper();

            // only add the following new nuget packlages if the project is a web project. We use a heuristic - if MVC is there as a dependency then its a web project.
            if (projectWrapper.IsMvcProject())
            {
                package                 = new DependencyPackageMigrationInfo("Microsoft.VisualStudio.Web.CodeGeneration.Tools", $"1.0.0-{toolingVersion}-final");
                package.Type            = PackageType.Build;
                package.MigrationAction = PackageMigrationAction.AddOrUpdate;
                list.Add(package);

                // ensure Microsoft.AspNetCore.Diagnostics is brought in
                package = new DependencyPackageMigrationInfo("Microsoft.AspNetCore.Diagnostics", "1.0.0-rc2-final");
                package.OldNames.Add("Microsoft.AspNet.Diagnostics");
                package.MigrationAction = PackageMigrationAction.AddOrUpdate;
                list.Add(package);
            }

            package = new DependencyPackageMigrationInfo("Microsoft.VisualStudio.Web.CodeGenerators.Mvc", $"1.0.0-{toolingVersion}-final");
            package.OldNames.Add("Microsoft.Extensions.CodeGenerators.Mvc");
            package.Type = PackageType.Build;
            list.Add(package);


            package = new DependencyPackageMigrationInfo("Microsoft.ApplicationInsights.AspNetCore", "1.0.0-rc2-final");
            package.OldNames.Add("Microsoft.ApplicationInsights.AspNet");
            list.Add(package);

            // Ensure following package is present if depending on IISPlatformHandler
            if (projectWrapper.HasDependency("Microsoft.AspNet.IISPlatformHandler") ||
                projectWrapper.HasDependency("Microsoft.AspNetCore.Server.IISIntegration"))
            {
                package = new DependencyPackageMigrationInfo("Microsoft.AspNetCore.Hosting", $"1.0.0-rc2-final");
                package.MigrationAction = PackageMigrationAction.AddOrUpdate;
                list.Add(package);
            }

            // remove Microsoft.Dnx.Runtime
            package = new DependencyPackageMigrationInfo("Microsoft.Dnx.Runtime", "1.0.0-rc1-final");
            package.MigrationAction = PackageMigrationAction.Remove;
            list.Add(package);


            return(list);
        }
        public List <DependencyPackageMigrationInfo> GetPackageMigrations(ToolingVersion targetToolingVersion, IProjectUpgradeContext projectContext)
        {
            var    list           = new List <DependencyPackageMigrationInfo>();
            string toolingVersion = targetToolingVersion.ToString().ToLowerInvariant();

            var package = new DependencyPackageMigrationInfo("Microsoft.Extensions.Configuration.FileExtensions", "1.0.0-rc2-final");

            package.OldNames.Add("Microsoft.Extensions.Configuration.FileProviderExtensions");
            list.Add(package);


            // If Microsoft.Extensions.PlatformAbstractions package is referenced, it was split out in RC2 so add the new package as well, in case you were using classes from it.
            if (projectContext.ToProjectJsonWrapper().HasDependency("Microsoft.Extensions.PlatformAbstractions"))
            {
                package = new DependencyPackageMigrationInfo("Microsoft.Extensions.DependencyModel", "1.0.0-rc2-final");
                package.MigrationAction = PackageMigrationAction.AddOrUpdate;
                list.Add(package);
            }

            // only add the following new nuget packlages if the project is a web project. We use a heuristic - if MVC is there as a dependency then its a web project.
            if (projectContext.ToProjectJsonWrapper().IsMvcProject())
            {
                package = new DependencyPackageMigrationInfo("Microsoft.Extensions.Options.ConfigurationExtensions", $"1.0.0-rc2-final");
                package.MigrationAction = PackageMigrationAction.AddOrUpdate;
                list.Add(package);
            }



            return(list);
        }
コード例 #24
0
        protected virtual IList <IProjectUpgradeAction> GetPackagesUpgrades(IProjectUpgradeContext projectUpgradeContext, ReleaseVersion version)
        {
            var upgradeActions = new List <IProjectUpgradeAction>();


            //if (version == ReleaseVersion.RC2)
            //{
            // migrates specific nuget packages where their name has completely changed, and also adds new ones that the project may require.
            // this is currently described by a hardcoded list.
            ToolingVersion toolingVersion = ToolingVersion.Preview1;

            if (version == ReleaseVersion.RTM)
            {
                toolingVersion = ToolingVersion.Preview2;
            }
            var nugetPackagesToMigrate = ProjectMigrator.GetRc2DependencyPackageMigrationList(toolingVersion, projectUpgradeContext);
            var packageMigrationAction = new MigrateDependencyPackages(nugetPackagesToMigrate);

            upgradeActions.Add(packageMigrationAction);

            // renames microsoft.aspnet packages to be microsoft.aspnetcore.
            var renameAspNetPackagesAction = new RenameAspNetPackagesToAspNetCore();

            upgradeActions.Add(renameAspNetPackagesAction);

            // updates microsoft. packages to be rc2 version numbers.
            var updateMicrosoftPackageVersionNumbersAction = new UpgradeMicrosoftPackageVersionNumbers(version);

            upgradeActions.Add(updateMicrosoftPackageVersionNumbersAction);

            // renames "commands" to "tools"
            var renameCommandstoToolsAndClear = new RenameCommandsToTools();

            upgradeActions.Add(renameCommandstoToolsAndClear);

            // migrates old command packages to the new tool nuget packages.
            var toolPackagestoMigrate = GetToolPackageMigrationList(ToolingVersion.Preview1, projectUpgradeContext);
            var migrateToolPackages   = new MigrateToolPackages(toolPackagestoMigrate);

            upgradeActions.Add(migrateToolPackages);

            // }

            if (version == ReleaseVersion.RTM)
            {
                // migrates specific nuget packages where their name has completely changed, and also adds new ones that the project may require.
                // this is currently described by a hardcoded list.
                var nugetPackagesToMigrateRTM = ProjectMigrator.GetRtmDependencyPackageMigrationList(ToolingVersion.Preview2, projectUpgradeContext);
                var packageMigrationActionRTM = new MigrateDependencyPackages(nugetPackagesToMigrateRTM);
                upgradeActions.Add(packageMigrationActionRTM);

                // updates remaining microsoft rc2 packages to be rtm version numbers i.e 1.0.0 instead of 1.0.0-rc2-final
                var updateMicrosoftPackageVersionNumbersActionRtm = new UpgradeMicrosoftPackageVersionNumbers(version);
                upgradeActions.Add(updateMicrosoftPackageVersionNumbersActionRtm);


                // migrates old command packages to the new tool nuget packages.
                var toolPackagestoMigrateRtm = GetToolPackageMigrationList(ToolingVersion.Preview2, projectUpgradeContext);
                var migrateToolPackagesRtm   = new MigrateToolPackages(toolPackagestoMigrateRtm);
                upgradeActions.Add(migrateToolPackagesRtm);
            }

            return(upgradeActions);
        }
        public List <DependencyPackageMigrationInfo> GetPackageMigrations(ToolingVersion targetToolingVersion, IProjectUpgradeContext projectContext)
        {
            var    list           = new List <DependencyPackageMigrationInfo>();
            string toolingVersion = ToolingVersion.Preview1.ToString().ToLowerInvariant();

            // aspnet packages
            var package = new DependencyPackageMigrationInfo("Autofac", "4.0.0-rc3-280");

            list.Add(package);

            package = new DependencyPackageMigrationInfo("Autofac.Extensions.DependencyInjection", "4.0.0-rc3-280");
            list.Add(package);


            return(list);
        }
コード例 #26
0
        public static List <DependencyPackageMigrationInfo> GetRtmDependencyPackageMigrationList(ToolingVersion targetToolingVersion, IProjectUpgradeContext projectContext)
        {
            var packageMigrationProviders = new List <IDependencyPackageMigrationProvider>();

            //    packageMigrationProviders.Add(new AspNetDependencyPackageMigrationProvider());
            packageMigrationProviders.Add(new EntityFrameworkRtmDependencyPackageMigrationProvider());
            packageMigrationProviders.Add(new AspNetRtmDependencyPackageMigrationProvider());


            var migrations = new List <DependencyPackageMigrationInfo>();

            foreach (var provider in packageMigrationProviders)
            {
                var packageMigrations = provider.GetPackageMigrations(targetToolingVersion, projectContext);
                migrations.AddRange(packageMigrations);
            }

            return(migrations);
            // Microsoft.VisualStudio.Web.BrowserLink.Loader?
        }
コード例 #27
0
        public static List <ToolPackageMigrationInfo> GetToolPackageMigrationList(ToolingVersion targetToolingVersion, IProjectUpgradeContext projectContext)
        {
            var toolMigrationProviders = new List <IToolPackageMigrationProvider>();

            toolMigrationProviders.Add(new CommonToolPackagesMigration());

            var migrations = new List <ToolPackageMigrationInfo>();

            foreach (var provider in toolMigrationProviders)
            {
                var packageMigrations = provider.GetPackageMigrations(targetToolingVersion, projectContext);
                migrations.AddRange(packageMigrations);
            }

            return(migrations);
        }
コード例 #28
0
        public void Apply(IProjectUpgradeContext fileUpgradeContext)
        {
            JObject projectJsonObject = fileUpgradeContext.ProjectJsonObject;

            MoveCompile(projectJsonObject);
        }
コード例 #29
0
 public void Apply(IProjectUpgradeContext fileUpgradeContext)
 {
     throw new System.NotImplementedException();
 }
 protected abstract JObject GetPackagesObject(IProjectUpgradeContext fileUpgradeContext);