예제 #1
0
        public override Task <PublishedApplication> Publish(DeploymentParameters deploymentParameters, ILogger logger)
        {
            // Treat AdditionalPublishParameters as profile name if defined
            string profileName;

            if (!string.IsNullOrEmpty(deploymentParameters.AdditionalPublishParameters))
            {
                profileName = deploymentParameters.AdditionalPublishParameters;
            }
            else if (deploymentParameters.ApplicationType == ApplicationType.Portable)
            {
                profileName = "Portable";
            }
            else
            {
                profileName = "Standalone-" + deploymentParameters.RuntimeArchitecture;
            }

            var configuration = this.GetType().GetTypeInfo().Assembly.GetCustomAttribute <AssemblyConfigurationAttribute>().Configuration;

            var path = Path.Combine(_applicationPath, "bin", configuration, deploymentParameters.TargetFramework, "publish", profileName);

            logger.LogInformation("Using prepublished application from {PublishDir}", path);

            var target = CreateTempDirectory();

            var source = new DirectoryInfo(path);

            CachingApplicationPublisher.CopyFiles(source, target, logger);
            return(Task.FromResult(new PublishedApplication(target.FullName, logger)));
        }
    public override Task <PublishedApplication> Publish(DeploymentParameters deploymentParameters, ILogger logger)
    {
        var path = Path.Combine(AppContext.BaseDirectory, GetProfileName(deploymentParameters));

        if (!Directory.Exists(path))
        {
            var solutionPath = GetProjectReferencePublishLocation(deploymentParameters);
            logger.LogInformation("{PublishDir} doesn't exist falling back to solution based path {SolutionBasedDir}", solutionPath, solutionPath);
            path = solutionPath;
        }

        logger.LogInformation("Using prepublished application from {PublishDir}", path);

        var target = CreateTempDirectory();

        var source = new DirectoryInfo(path);

        CachingApplicationPublisher.CopyFiles(source, target, logger);
        return(Task.FromResult(new PublishedApplication(target.FullName, logger)));
    }