IsWap() 공개 정적인 메소드

public static IsWap ( IEnumerable projectTypeGuids ) : bool
projectTypeGuids IEnumerable
리턴 bool
예제 #1
0
        private void EnsureProperties()
        {
            if (_initialized)
            {
                return;
            }

            _projectName = _projectNameProperty.GetValue <string>(_projectInstance);
            var relativePath = _relativePathProperty.GetValue <string>(_projectInstance);
            var projectType  = _projectTypeProperty.GetValue <SolutionProjectType>(_projectInstance);

            _absolutePath = Path.Combine(Path.GetDirectoryName(_solutionPath), relativePath);
            _isWebSite    = projectType == SolutionProjectType.WebProject;

            if (projectType == SolutionProjectType.KnownToBeMSBuildFormat && File.Exists(_absolutePath))
            {
                // If the project is an msbuild project then extra the project type guids
                _projectTypeGuids = VsHelper.GetProjectTypeGuids(_absolutePath);

                // Check if it's a wap
                _isWap = VsHelper.IsWap(_projectTypeGuids);
            }
            else
            {
                _projectTypeGuids = Enumerable.Empty <Guid>();
            }

            _initialized = true;
        }
예제 #2
0
        private void EnsureProperties()
        {
            if (_initialized)
            {
                return;
            }

            _projectName = _projectNameProperty.GetValue <string>(_projectInstance);
            var projectType      = _projectTypeProperty.GetValue <SolutionProjectType>(_projectInstance);
            var projectExtension = _projectExtensionProperty.GetValue <string>(_projectInstance);
            var relativePath     = _relativePathProperty.GetValue <string>(_projectInstance);

            _isWebSite = projectType == SolutionProjectType.WebProject;

            // When using websites with IISExpress, the relative path property becomes a URL.
            // When that happens we're going to grab the path from the Release.AspNetCompiler.PhysicalPath
            // property in the solution.

            Uri uri;

            if (_isWebSite && Uri.TryCreate(relativePath, UriKind.Absolute, out uri))
            {
                var aspNetConfigurations = _aspNetConfigurationsProperty.GetValue <Hashtable>(_projectInstance);

                // Use the release configuraiton and debug if it isn't available
                object configurationObject = aspNetConfigurations["Release"] ?? aspNetConfigurations["Debug"];

                // REVIEW: Is there always a configuration object (i.e. can this ever be null?)

                // The aspNetPhysicalPath contains the relative to the website
                FieldInfo aspNetPhysicalPathField = configurationObject.GetType().GetField("aspNetPhysicalPath", BindingFlags.NonPublic | BindingFlags.Instance);

                relativePath = (string)aspNetPhysicalPathField.GetValue(configurationObject);
            }

            _absolutePath = Path.Combine(Path.GetDirectoryName(_solutionPath), relativePath);

            if (projectType == SolutionProjectType.KnownToBeMSBuildFormat && File.Exists(_absolutePath))
            {
                // If the project is an msbuild project then extra the project type guids
                _projectTypeGuids = VsHelper.GetProjectTypeGuids(_absolutePath);

                // Check if it's a wap
                _isWap = VsHelper.IsWap(_projectTypeGuids);

                _isExecutable = VsHelper.IsExecutableProject(_absolutePath);
            }
            else if (projectExtension.Equals(".kproj", StringComparison.OrdinalIgnoreCase) && File.Exists(_absolutePath))
            {
                _isProjectK       = true;
                _absolutePath     = Path.Combine(Path.GetDirectoryName(_absolutePath), "project.json");
                _projectTypeGuids = Enumerable.Empty <Guid>();
            }
            else
            {
                _projectTypeGuids = Enumerable.Empty <Guid>();
            }

            _initialized = true;
        }
예제 #3
0
        private void EnsureProperties()
        {
            if (_initialized)
            {
                return;
            }

            _projectName = _projectNameProperty.GetValue <string>(_projectInstance);
            var projectType  = _projectTypeProperty.GetValue <SolutionProjectType>(_projectInstance);
            var relativePath = _relativePathProperty.GetValue <string>(_projectInstance);

            _isWebSite = projectType == SolutionProjectType.WebProject;

            // When using websites with IISExpress, the relative path property becomes a URL.
            // When that happens we're going to grab the path from the Release.AspNetCompiler.PhysicalPath
            // property in the solution.

            Uri uri;

            if (_isWebSite && Uri.TryCreate(relativePath, UriKind.Absolute, out uri))
            {
                var aspNetConfigurations = _aspNetConfigurationsProperty.GetValue <Hashtable>(_projectInstance);

                // Use the release configuration and debug if it isn't available
                object configurationObject = aspNetConfigurations["Release"] ?? aspNetConfigurations["Debug"];

                // REVIEW: Is there always a configuration object (i.e. can this ever be null?)

                // The aspNetPhysicalPath contains the relative to the website
                FieldInfo aspNetPhysicalPathField = configurationObject.GetType().GetField("aspNetPhysicalPath", BindingFlags.NonPublic | BindingFlags.Instance);

                relativePath = (string)aspNetPhysicalPathField.GetValue(configurationObject);
            }

            _absolutePath = Path.Combine(Path.GetDirectoryName(_solutionPath), relativePath);
            if (FileSystemHelpers.FileExists(_absolutePath) && DeploymentHelper.IsMsBuildProject(_absolutePath))
            {
                // used to determine project type from project file
                _projectTypeGuids = VsHelper.GetProjectTypeGuids(_absolutePath);

                _isAspNetCore    = AspNetCoreHelper.IsDotnetCoreFromProjectFile(_absolutePath, _projectTypeGuids);
                _isWap           = VsHelper.IsWap(_projectTypeGuids);
                _isExecutable    = VsHelper.IsExecutableProject(_absolutePath);
                _isFunctionApp   = FunctionAppHelper.LooksLikeFunctionApp();
                _targetFramework = VsHelper.GetTargetFramework(_absolutePath);
            }
            else
            {
                _projectTypeGuids = Enumerable.Empty <Guid>();
            }

            _initialized = true;
        }