コード例 #1
0
        // used when we have a project file
        private ISiteBuilder DetermineProject(string repositoryRoot, string targetPath, IDeploymentSettingsManager perDeploymentSettings, IFileFinder fileFinder)
        {
            var    solution         = VsHelper.FindContainingSolution(repositoryRoot, targetPath, fileFinder);
            string solutionPath     = solution?.Path;
            var    projectTypeGuids = VsHelper.GetProjectTypeGuids(targetPath);

            if (VsHelper.IsWap(projectTypeGuids))
            {
                return(new WapBuilder(_environment,
                                      perDeploymentSettings,
                                      _propertyProvider,
                                      repositoryRoot,
                                      targetPath,
                                      solutionPath));
            }
            else if (AspNetCoreHelper.IsDotnetCoreFromProjectFile(targetPath, projectTypeGuids))
            {
                return(new AspNetCoreBuilder(_environment,
                                             perDeploymentSettings,
                                             _propertyProvider,
                                             repositoryRoot,
                                             targetPath,
                                             solutionPath));
            }
            else if (VsHelper.IsExecutableProject(targetPath))
            {
                // This is a console app
                return(new DotNetConsoleBuilder(_environment,
                                                perDeploymentSettings,
                                                _propertyProvider,
                                                repositoryRoot,
                                                targetPath,
                                                solutionPath));
            }
            else if (FunctionAppHelper.LooksLikeFunctionApp())
            {
                if (FunctionAppHelper.IsCSharpFunctionFromProjectFile(targetPath))
                {
                    return(new FunctionMsbuildBuilder(_environment,
                                                      perDeploymentSettings,
                                                      _propertyProvider,
                                                      repositoryRoot,
                                                      targetPath,
                                                      solutionPath));
                }
                else
                {
                    // csx or node function with extensions.csproj
                    return(new FunctionBasicBuilder(_environment,
                                                    perDeploymentSettings,
                                                    _propertyProvider,
                                                    repositoryRoot,
                                                    Path.GetDirectoryName(targetPath)));
                }
            }

            throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                                                              Resources.Error_ProjectNotDeployable,
                                                              targetPath));
        }
コード例 #2
0
        private ISiteBuilder DetermineProject(string repositoryRoot, string targetPath, IDeploymentSettingsManager perDeploymentSettings, IFileFinder fileFinder)
        {
            var    solution         = VsHelper.FindContainingSolution(repositoryRoot, targetPath, fileFinder);
            string solutionPath     = solution?.Path;
            var    projectTypeGuids = VsHelper.GetProjectTypeGuids(targetPath);

            if (VsHelper.IsWap(projectTypeGuids))
            {
                return(new WapBuilder(_environment,
                                      perDeploymentSettings,
                                      _propertyProvider,
                                      repositoryRoot,
                                      targetPath,
                                      solutionPath));
            }
            else if (AspNetCoreHelper.IsDotnetCorePreview3(targetPath, projectTypeGuids) || targetPath.EndsWith(".xproj", StringComparison.OrdinalIgnoreCase))
            {
                return(new AspNetCoreBuilder(_environment,
                                             perDeploymentSettings,
                                             _propertyProvider,
                                             repositoryRoot,
                                             targetPath,
                                             solutionPath));
            }
            else if (VsHelper.IsExecutableProject(targetPath))
            {
                // This is a console app
                return(new DotNetConsoleBuilder(_environment,
                                                perDeploymentSettings,
                                                _propertyProvider,
                                                repositoryRoot,
                                                targetPath,
                                                solutionPath));
            }

            throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                                                              Resources.Error_ProjectNotDeployable,
                                                              targetPath));
        }
コード例 #3
0
 public static bool IsDeployableProject(string path)
 {
     return(IsProject(path) &&
            (VsHelper.IsWap(path) || VsHelper.IsExecutableProject(path)));
 }