Пример #1
0
        private async Task <string> GetTargetFrameworkStringAsync()
        {
            await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync();

            var projectPath        = FullName;
            var platformIdentifier = BuildProperties.GetPropertyValue(
                ProjectBuildProperties.TargetPlatformIdentifier);
            var platformVersion = BuildProperties.GetPropertyValue(
                ProjectBuildProperties.TargetPlatformVersion);
            var platformMinVersion = BuildProperties.GetPropertyValue(
                ProjectBuildProperties.TargetPlatformMinVersion);
            var targetFrameworkMoniker = BuildProperties.GetPropertyValue(
                ProjectBuildProperties.TargetFrameworkMoniker);

            // Projects supporting TargetFramework and TargetFrameworks are detected before
            // this check. The values can be passed as null here.
            var frameworkStrings = MSBuildProjectFrameworkUtility.GetProjectFrameworkStrings(
                projectFilePath: projectPath,
                targetFrameworks: null,
                targetFramework: null,
                targetFrameworkMoniker: targetFrameworkMoniker,
                targetPlatformIdentifier: platformIdentifier,
                targetPlatformVersion: platformVersion,
                targetPlatformMinVersion: platformMinVersion);

            return(frameworkStrings.FirstOrDefault());
        }
Пример #2
0
        public async Task <IEnumerable <RuntimeDescription> > GetRuntimeIdentifiersAsync()
        {
            await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync();

            var unparsedRuntimeIdentifer = BuildProperties.GetPropertyValue(
                ProjectBuildProperties.RuntimeIdentifier);
            var unparsedRuntimeIdentifers = BuildProperties.GetPropertyValue(
                ProjectBuildProperties.RuntimeIdentifiers);

            var runtimes = Enumerable.Empty <string>();

            if (unparsedRuntimeIdentifer != null)
            {
                runtimes = runtimes.Concat(new[] { unparsedRuntimeIdentifer });
            }

            if (unparsedRuntimeIdentifers != null)
            {
                runtimes = runtimes.Concat(unparsedRuntimeIdentifers.Split(';'));
            }

            runtimes = runtimes
                       .Select(x => x.Trim())
                       .Distinct(StringComparer.Ordinal)
                       .Where(x => !string.IsNullOrEmpty(x));

            return(runtimes
                   .Select(runtime => new RuntimeDescription(runtime)));
        }
Пример #3
0
        public async Task <string> GetMSBuildProjectExtensionsPathAsync()
        {
            var msbuildProjectExtensionsPath = BuildProperties.GetPropertyValue(ProjectBuildProperties.MSBuildProjectExtensionsPath);

            if (string.IsNullOrEmpty(msbuildProjectExtensionsPath))
            {
                return(null);
            }

            return(Path.Combine(await GetProjectDirectoryAsync(), msbuildProjectExtensionsPath));
        }
Пример #4
0
        private Task <string> GetTargetFrameworkStringAsync()
        {
            var frameworkStrings = MSBuildProjectFrameworkUtility.GetProjectFrameworkStrings(
                projectFilePath: ProjectFilePath,
                targetFrameworks: BuildProperties.GetPropertyValue("TargetFrameworks"),
                targetFramework: BuildProperties.GetPropertyValue("TargetFramework"),
                targetFrameworkMoniker: BuildProperties.GetPropertyValue("TargetFrameworkMoniker"),
                targetPlatformIdentifier: BuildProperties.GetPropertyValue("TargetPlatformIdentifier"),
                targetPlatformVersion: BuildProperties.GetPropertyValue("TargetPlatformVersion"),
                targetPlatformMinVersion: BuildProperties.GetPropertyValue("TargetPlatformMinVersion"));

            return(Task.FromResult(frameworkStrings.FirstOrDefault()));
        }
Пример #5
0
        public async Task <IEnumerable <CompatibilityProfile> > GetRuntimeSupportsAsync()
        {
            await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync();

            var unparsedRuntimeSupports = BuildProperties.GetPropertyValue(
                ProjectBuildProperties.RuntimeSupports);

            if (unparsedRuntimeSupports == null)
            {
                return(Enumerable.Empty <CompatibilityProfile>());
            }

            return(unparsedRuntimeSupports
                   .Split(';')
                   .Select(x => x.Trim())
                   .Where(x => !string.IsNullOrEmpty(x))
                   .Select(support => new CompatibilityProfile(support)));
        }