Example #1
0
        private static void ReadTargetFrameworkId()
        {
            String targetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();

            var overrideValue = System.Runtime.Versioning.CompatibilitySwitch.GetValueInternal("TargetFrameworkMoniker");

            if (!string.IsNullOrEmpty(overrideValue))
            {
                targetFrameworkName = overrideValue;
            }

            // Write to a local then to _targetFramework, after writing the version number.
            TargetFrameworkId fxId;
            int fxVersion = 0;

            if (targetFrameworkName == null)
            {
                fxId = TargetFrameworkId.Unspecified;
            }
            else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
            {
                fxId = TargetFrameworkId.Unrecognized;
            }

            s_AppWasBuiltForFramework = fxId;
            s_AppWasBuiltForVersion   = fxVersion;
        }
Example #2
0
 public IEnumerable <PackageDependency> GetPackages(TargetFrameworkId targetFrameworkId)
 {
     // There isn't an official nuget for Unity, sadly, so add this feed to test/data/nuget.config
     // <add key="unity-testlibs" value="https://myget.org/F/resharper-unity/api/v2/" />
     return(from name in GetPackageNames()
            select TestPackagesAttribute.ParsePackageDependency(name));
 }
Example #3
0
 public bool IsSupported(IProject project, TargetFrameworkId targetFrameworkId)
 {
     using (ReadLockCookie.Create())
     {
         return(ReferencedAssembliesService.IsProjectReferencingAssemblyByName(project, targetFrameworkId, MSpecReferenceName, out AssemblyNameInfo _));
     }
 }
        private static void ReadTargetFrameworkId()
        {
            String targetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();

            var overrideValue = System.Runtime.Versioning.CompatibilitySwitch.GetValueInternal("TargetFrameworkMoniker");

            if (!string.IsNullOrEmpty(overrideValue))
            {
                targetFrameworkName = overrideValue;
            }

            // Write to a local then to _targetFramework, after writing the version number.
            TargetFrameworkId fxId;
            int fxVersion = 0;

            if (targetFrameworkName == null)
            {
#if FEATURE_CORECLR
                // We are going to default to the latest value for version that we have in our code.
                fxId      = TargetFrameworkId.NetFramework;
                fxVersion = 50000;
#else
                fxId = TargetFrameworkId.Unspecified;
#endif
            }
            else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
            {
                fxId = TargetFrameworkId.Unrecognized;
            }

            s_AppWasBuiltForFramework = fxId;
            s_AppWasBuiltForVersion   = fxVersion;
        }
 public UnityShaderModule(ISolution solution, String name, TargetFrameworkId targetFrameworkId)
 {
     mySolution        = solution;
     myPersistentId    = "UnityShaderModule:" + name;
     TargetFrameworkId = targetFrameworkId;
     Files             = new Dictionary <IProjectFile, PsiProjectFile>();
 }
Example #6
0
        private static void ReadTargetFrameworkId()
        {
            string targetFrameworkName = string.Empty;

            AssemblyName[] assNames = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
            foreach (AssemblyName name in assNames)
            {
                if (name.Name == "mscorlib")
                {
                    targetFrameworkName = name.Version.ToString();
                }
            }
            int num = 0;
            TargetFrameworkId targetFrameworkId;

            if (targetFrameworkName == null)
            {
                targetFrameworkId = TargetFrameworkId.Unspecified;
            }
            else
            {
                if (!BinaryCompatibility.ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out targetFrameworkId, out num))
                {
                    targetFrameworkId = TargetFrameworkId.Unrecognized;
                }
            }
            BinaryCompatibility.s_AppWasBuiltForFramework = targetFrameworkId;
            BinaryCompatibility.s_AppWasBuiltForVersion   = num;
        }
        public IRuntimeEnvironment GetRuntimeEnvironment(IUnitTestLaunch launch, IProject project,
                                                         TargetFrameworkId targetFrameworkId,
                                                         IUnitTestElement element)
        {
            var targetPlatform = TargetPlatformCalculator.GetTargetPlatform(launch, project, targetFrameworkId);

            return(new UnityRuntimeEnvironment(targetPlatform, project));
        }
Example #8
0
        public IEnumerable <string> GetReferences(TargetFrameworkId targetFrameworkId, FileSystemPath testDataPath,
                                                  NugetPackagesCache nugetPackagesCache)
        {
            var names     = GetPackageNames().ToArray();
            var attribute = new TestPackagesAttribute(names);

            return(attribute.GetReferences(targetFrameworkId, testDataPath, nugetPackagesCache));
        }
Example #9
0
 public MspecTestElementMapper(
     IProject project,
     TargetFrameworkId targetFrameworkId,
     UnitTestElementFactory factory
     ) : base(project, targetFrameworkId)
 {
     _project           = project;
     _targetFrameworkId = targetFrameworkId;
     _factory           = factory;
 }
Example #10
0
 public UnityExternalFilesPsiModule([NotNull] ISolution solution, string moduleName, string persistentId,
                                    TargetFrameworkId targetFrameworkId, Lifetime lifetime)
 {
     mySolution        = solution;
     myPersistentId    = persistentId;
     myLifetime        = lifetime;
     Name              = moduleName;
     TargetFrameworkId = targetFrameworkId;
     mySourceFiles     = new CompactMap <FileSystemPath, Pair <IPsiSourceFile, LifetimeDefinition> >();
 }
Example #11
0
 public override IEnumerable <PackageDependency> GetPackages(TargetFrameworkId targetFrameworkId)
 {
     foreach (var package in GetPackagesCommon())
     {
         yield return(package);
     }
     foreach (var package in base.GetPackages(targetFrameworkId))
     {
         yield return(package);
     }
 }
 public UnityTestFileExplorer(IFile file, UnityTestElementFactory factory, UnitTestAttributeCache unitTestAttributeCache,
                              IUnitTestElementsObserver observer, Func <bool> interrupted, IProject project)
 {
     myFile    = file;
     myFactory = factory;
     myUnitTestAttributeCache = unitTestAttributeCache;
     myObserver          = observer;
     myInterrupted       = interrupted;
     myProject           = project;
     myTargetFrameworkId = myProject.GetCurrentTargetFrameworkId();
 }
Example #13
0
        private static bool IsAppUnderSL81CompatMode()
        {
            Contract.Assert(s_AppWasBuiltForFramework == TargetFrameworkId.NotYetChecked);

            if (CompatibilitySwitches.IsAppSilverlight81)
            {
                // This is an SL8.1 scenario and hence it gets the same quirks as WPBlue+ settings.
                s_AppWasBuiltForFramework = TargetFrameworkId.Phone;
                s_AppWasBuiltForVersion   = 80100;

                return(true);
            }

            return(false);
        }
Example #14
0
 internal T4PsiModuleProvider(
     Lifetime lifetime,
     [NotNull] IShellLocks shellLocks,
     [NotNull] ChangeManager changeManager,
     [NotNull] IT4Environment t4Environment,
     [NotNull] IT4TemplateKindProvider templateDataManager,
     [CanBeNull] TargetFrameworkId primaryTargetFrameworkId = null
     )
 {
     _lifetime                = lifetime;
     _shellLocks              = shellLocks;
     _changeManager           = changeManager;
     _t4Environment           = t4Environment;
     TemplateDataManager      = templateDataManager;
     PrimaryTargetFrameworkId = primaryTargetFrameworkId;
 }
Example #15
0
        private static void ReadTargetFrameworkId()
        {
#if FEATURE_CORECLR
            if (IsAppUnderSL81CompatMode())
            {
                // Since the SL does not have any Main() the reading of the TFM will not work and as a workaround we use the CompatibilitySwitch.IsAppSilverlight81
                // to identify if the given app targets SL 8.1 and accordingly give it the value TargetFrameworkId.Phone;80100

                // PS - This also means that the CompatMode set by AppDomain m_compatFlags with AppDomainCompatMode.APPDOMAINCOMPAT_APP_SL81
                // will override any other mechanism like TFM, RegistryKey, env variable or config file settings. Since this option
                // is only used by SL8.1 scenario's I don't think this is an issue and is rather desirable.

                return;
            }
#endif //FEATURE_CORECLR
            String targetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();

            var overrideValue = System.Runtime.Versioning.CompatibilitySwitch.GetValueInternal("TargetFrameworkMoniker");
            if (!string.IsNullOrEmpty(overrideValue))
            {
                targetFrameworkName = overrideValue;
            }

            // Write to a local then to _targetFramework, after writing the version number.
            TargetFrameworkId fxId;
            int fxVersion = 0;
            if (targetFrameworkName == null)
            {
#if FEATURE_CORECLR
                // if we don't have a value for targetFrameworkName we need to figure out if we should give the newest behavior or not.
                if (CompatibilitySwitches.UseLatestBehaviorWhenTFMNotSpecified)
                {
                    fxId      = TargetFrameworkId.NetFramework;
                    fxVersion = 50000; // We are going to default to the latest value for version that we have in our code.
                }
                else
#endif
                fxId = TargetFrameworkId.Unspecified;
            }
            else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
            {
                fxId = TargetFrameworkId.Unrecognized;
            }

            s_AppWasBuiltForFramework = fxId;
            s_AppWasBuiltForVersion   = fxVersion;
        }
Example #16
0
 internal T4ResolveProject(
     [NotNull] Lifetime lifetime,
     [NotNull] ISolution solution,
     [NotNull] IShellLocks shellLocks,
     [NotNull] PlatformID platformID,
     [NotNull] TargetFrameworkId targetFrameworkId,
     [NotNull] IUserDataHolder dataHolder)
 {
     _shellLocks                = shellLocks;
     _targetFrameworkId         = targetFrameworkId;
     _solution                  = solution;
     _dataHolder                = dataHolder;
     _projectProperties         = new T4ResolveProjectProperties(platformID, targetFrameworkId);
     ProjectFileLocationLive    = new Property <FileSystemPath>(lifetime, "ProjectFileLocationLive");
     ProjectLocationLive        = new Property <FileSystemPath>(lifetime, "ProjectLocationLive");
     _targetFrameworkReferences = new TargetFrameworkReferences(lifetime, shellLocks, this, solution.SolutionOwner.GetComponent <AssemblyInfoDatabase>());
 }
Example #17
0
        private static void ReadTargetFrameworkId()
        {
            String targetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();
            // Write to a local then to _targetFramework, after writing the version number.
            TargetFrameworkId fxId;
            int fxVersion = 0;

            if (targetFrameworkName == null)
            {
                fxId = TargetFrameworkId.Unspecified;
            }
            else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
            {
                fxId = TargetFrameworkId.Unrecognized;
            }

            s_AppWasBuiltForFramework = fxId;
            s_AppWasBuiltForVersion   = fxVersion;
        }
Example #18
0
        public T4FilePsiModule(
            Lifetime lifetime,
            [NotNull] IProjectFile projectFile,
            [NotNull] ChangeManager changeManager,
            [NotNull] IShellLocks shellLocks,
            [NotNull] IT4Environment t4Environment,
            [CanBeNull] TargetFrameworkId primaryTargetFrameworkId
            )
        {
            Lifetime = lifetime;
            lifetime.AddDispose(this);
            ProjectFile    = projectFile;
            Solution       = ProjectFile.GetSolution();
            PsiModules     = Solution.GetComponent <IPsiModules>();
            PsiServices    = Solution.GetComponent <IPsiServices>();
            ChangeManager  = changeManager;
            ShellLocks     = shellLocks;
            ChangeProvider = new T4WriteOnlyChangeProvider();
            changeManager.RegisterChangeProvider(lifetime, ChangeProvider);
            changeManager.AddDependency(lifetime, PsiModules, ChangeProvider);
            TargetFrameworkId = t4Environment.SelectTargetFrameworkId(primaryTargetFrameworkId, projectFile);
            Project           = ProjectFile.GetProject().NotNull();
            var resolveContext = Project.IsMiscFilesProject()
                                ? UniversalModuleReferenceContext.Instance
                                : this.GetResolveContextEx(ProjectFile);

            Assertion.Assert(resolveContext.TargetFramework == TargetFrameworkId, "Failed to select TargetFrameworkId");
            var documentManager = Solution.GetComponent <DocumentManager>();

            SourceFile = CreateSourceFile(ProjectFile, documentManager, resolveContext);
            AssemblyReferenceManager = new T4AssemblyReferenceManager(
                Solution.GetComponent <IAssemblyFactory>(),
                SourceFile,
                ProjectFile,
                resolveContext,
                shellLocks
                );

            Solution.GetComponent <T4DeclaredAssembliesManager>().FileDataChanged.Advise(lifetime, OnFileDataChanged);
            PersistentId = BuildPersistentId(primaryTargetFrameworkId);
            OriginalTargetFrameworkId = primaryTargetFrameworkId;
        }
Example #19
0
        public static TargetFrameworkId SelectTargetFrameworkId(
            [NotNull] this IT4Environment t4Environment,
            [CanBeNull] TargetFrameworkId candidate,
            [NotNull] IProjectFile file
            )
        {
            var project = file.GetProject();

            if (project?.IsMiscFilesProject() != false)
            {
                return(UniversalModuleReferenceContext.Instance.TargetFramework);
            }
            // Generated C# code contains references to CodeDom, and thus can only be compiled by classical .NET
            // TODO: generate code without CodeDom in .NET Core projects
            if (candidate != null && candidate.IsNetFramework)
            {
                return(candidate);
            }
            return(t4Environment.TargetFrameworkId);
        }
Example #20
0
        private static void ReadTargetFrameworkId()
        {
            string targetFrameworkMoniker = AppDomain.CurrentDomain.GetTargetFrameworkName();
            string valueInternal          = CompatibilitySwitch.GetValueInternal("TargetFrameworkMoniker");

            if (!string.IsNullOrEmpty(valueInternal))
            {
                targetFrameworkMoniker = valueInternal;
            }
            int targetFrameworkVersion = 0;
            TargetFrameworkId targetFramework;

            if (targetFrameworkMoniker == null)
            {
                targetFramework = TargetFrameworkId.Unspecified;
            }
            else if (!BinaryCompatibility.ParseTargetFrameworkMonikerIntoEnum(targetFrameworkMoniker, out targetFramework, out targetFrameworkVersion))
            {
                targetFramework = TargetFrameworkId.Unrecognized;
            }
            BinaryCompatibility.s_AppWasBuiltForFramework = targetFramework;
            BinaryCompatibility.s_AppWasBuiltForVersion   = targetFrameworkVersion;
        }
Example #21
0
            // The purpose of this method is to capture information about integrations & behavioral compatibility
            // between our multiple different release vehicles.  IE, if a behavior shows up in Silverlight version 5,
            // does it show up in the .NET Framework version 4.5 and Windows Phone 8?
            // Version number is major * 10000 + minor * 100 + build (ie, 4.5.1.0 would be version 40501).
            private void AddQuirksForFramework(TargetFrameworkId builtAgainstFramework, int buildAgainstVersion)
            {
                Contract.Requires(buildAgainstVersion > 0  || builtAgainstFramework == TargetFrameworkId.Unspecified);

                switch (builtAgainstFramework)
                {
                    case TargetFrameworkId.NetFramework:
                    case TargetFrameworkId.NetCore:   // Treat Windows 8 tailored apps as normal desktop apps - same product
                        if (buildAgainstVersion >= 50000)
                            TargetsAtLeast_Desktop_V5_0 = true;

                        // Potential 4.5 servicing releases
                        if (buildAgainstVersion >= 40504)
                            TargetsAtLeast_Desktop_V4_5_4 = true;
                        if (buildAgainstVersion >= 40503)
                            TargetsAtLeast_Desktop_V4_5_3 = true;
                        if (buildAgainstVersion >= 40502)
                            TargetsAtLeast_Desktop_V4_5_2 = true;
                        if (buildAgainstVersion >= 40501)
                            TargetsAtLeast_Desktop_V4_5_1 = true;

                        if (buildAgainstVersion >= 40500)
                        {
                            TargetsAtLeast_Desktop_V4_5 = true;
                            // On XX/XX/XX we integrated all changes from the phone V7_1 into the branch from which contains Desktop V4_5, thus 
                            // Any application built for V4_5 (or above) should have all the quirks for Phone V7_1 turned on.
                            AddQuirksForFramework(TargetFrameworkId.Phone, 70100);
                            // All Silverlight 5 behavior should be in the .NET Framework version 4.5
                            AddQuirksForFramework(TargetFrameworkId.Silverlight, 50000);
                        }
                        break;

                    case TargetFrameworkId.Phone:
                        if (buildAgainstVersion >= 80000)
                        {
                            // This is for Apollo apps. For Apollo apps we don't want to enable any of the 4.5 or 4.5.1 quirks
                            TargetsAtLeast_Phone_V8_0 = true;
                            //TargetsAtLeast_Desktop_V4_5 = true;
                        }
                        if (buildAgainstVersion >= 80100)
                        {
                            // For WindowsPhone 8.1 and SL 8.1 scenarios we want to enable both 4.5 and 4.5.1 quirks.
                            TargetsAtLeast_Desktop_V4_5 = true;
                            TargetsAtLeast_Desktop_V4_5_1 = true;
                        }

                        if (buildAgainstVersion >= 710)
                            TargetsAtLeast_Phone_V7_1 = true;
                        break;

                    case TargetFrameworkId.Silverlight:
                        if (buildAgainstVersion >= 40000)
                            TargetsAtLeast_Silverlight_V4 = true;

                        if (buildAgainstVersion >= 50000)
                            TargetsAtLeast_Silverlight_V5 = true;

                        if (buildAgainstVersion >= 60000)
                        {
                            TargetsAtLeast_Silverlight_V6 = true;
                        }
                        break;

                    case TargetFrameworkId.Unspecified:
                        break;

                    case TargetFrameworkId.NotYetChecked:
                    case TargetFrameworkId.Unrecognized:
                        Contract.Assert(false, "Bad framework kind");
                        break;
                    default:
                        Contract.Assert(false, "Error: we introduced a new Target Framework but did not update our binary compatibility map");
                        break;
                }
            }
Example #22
0
 private static void ReadTargetFrameworkId()
 {
     string targetFrameworkName = string.Empty;
     AssemblyName[] assNames = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
     foreach (AssemblyName name in assNames)
         if (name.Name == "mscorlib")
         {
             targetFrameworkName = name.Version.ToString();
         }
     int num = 0;
     TargetFrameworkId targetFrameworkId;
     if (targetFrameworkName == null)
     {
         targetFrameworkId = TargetFrameworkId.Unspecified;
     }
     else
     {
         if (!BinaryCompatibility.ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out targetFrameworkId, out num))
         {
             targetFrameworkId = TargetFrameworkId.Unrecognized;
         }
     }
     BinaryCompatibility.s_AppWasBuiltForFramework = targetFrameworkId;
     BinaryCompatibility.s_AppWasBuiltForVersion = num;
 }
Example #23
0
 private void AddQuirksForFramework(TargetFrameworkId builtAgainstFramework, int buildAgainstVersion)
 {
     switch (builtAgainstFramework)
     {
         case TargetFrameworkId.NotYetChecked:
         case TargetFrameworkId.Unrecognized:
         case TargetFrameworkId.Unspecified:
         case TargetFrameworkId.Portable:
             break;
         case TargetFrameworkId.NetFramework:
         case TargetFrameworkId.NetCore:
             if (buildAgainstVersion >= 50000)
             {
                 this.TargetsAtLeast_Desktop_V5_0 = true;
             }
             if (buildAgainstVersion >= 40504)
             {
                 this.TargetsAtLeast_Desktop_V4_5_4 = true;
             }
             if (buildAgainstVersion >= 40503)
             {
                 this.TargetsAtLeast_Desktop_V4_5_3 = true;
             }
             if (buildAgainstVersion >= 40502)
             {
                 this.TargetsAtLeast_Desktop_V4_5_2 = true;
             }
             if (buildAgainstVersion >= 40501)
             {
                 this.TargetsAtLeast_Desktop_V4_5_1 = true;
             }
             if (buildAgainstVersion >= 40500)
             {
                 this.TargetsAtLeast_Desktop_V4_5 = true;
                 this.AddQuirksForFramework(TargetFrameworkId.Phone, 70100);
                 this.AddQuirksForFramework(TargetFrameworkId.Silverlight, 50000);
                 return;
             }
             break;
         case TargetFrameworkId.Silverlight:
             if (buildAgainstVersion >= 40000)
             {
                 this.TargetsAtLeast_Silverlight_V4 = true;
             }
             if (buildAgainstVersion >= 50000)
             {
                 this.TargetsAtLeast_Silverlight_V5 = true;
             }
             if (buildAgainstVersion >= 60000)
             {
                 this.TargetsAtLeast_Silverlight_V6 = true;
             }
             break;
         case TargetFrameworkId.Phone:
             if (buildAgainstVersion >= 80000)
             {
                 this.TargetsAtLeast_Phone_V8_0 = true;
             }
             if (buildAgainstVersion >= 710)
             {
                 this.TargetsAtLeast_Phone_V7_1 = true;
                 return;
             }
             break;
         default:
             return;
     }
 }
        private static void ReadTargetFrameworkId()
        {
            String targetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();

            var overrideValue = System.Runtime.Versioning.CompatibilitySwitch.GetValueInternal("TargetFrameworkMoniker");
            if (!string.IsNullOrEmpty(overrideValue))
            {
                targetFrameworkName = overrideValue;
            }

            // Write to a local then to _targetFramework, after writing the version number.
            TargetFrameworkId fxId;
            int fxVersion = 0;
            if (targetFrameworkName == null)
            {
#if FEATURE_CORECLR
                // if we don't have a value for targetFrameworkName we need to figure out if we should give the newest behavior or not.
                if (CompatibilitySwitches.UseLatestBehaviorWhenTFMNotSpecified)
                {
                    fxId = TargetFrameworkId.NetFramework;
                    fxVersion = 50000; // We are going to default to the latest value for version that we have in our code.
                }
                else
#endif
                    fxId = TargetFrameworkId.Unspecified;
            }
            else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
                fxId = TargetFrameworkId.Unrecognized;

            s_AppWasBuiltForFramework = fxId;
            s_AppWasBuiltForVersion = fxVersion;
        }
Example #25
0
 private static bool ParseTargetFrameworkMonikerIntoEnum(string targetFrameworkMoniker, out TargetFrameworkId targetFramework, out int targetFrameworkVersion)
 {
     targetFramework = TargetFrameworkId.NotYetChecked;
     targetFrameworkVersion = 0;
     string text = null;
     string text2 = null;
     BinaryCompatibility.ParseFrameworkName(targetFrameworkMoniker, out text, out targetFrameworkVersion, out text2);
     string a;
     if ((a = text) != null)
     {
         if (a == ".NETFramework")
         {
             targetFramework = TargetFrameworkId.NetFramework;
             return true;
         }
         if (a == ".NETPortable")
         {
             targetFramework = TargetFrameworkId.Portable;
             return true;
         }
         if (a == ".NETCore")
         {
             targetFramework = TargetFrameworkId.NetCore;
             return true;
         }
         if (a == "Silverlight")
         {
             targetFramework = TargetFrameworkId.Silverlight;
             if (string.IsNullOrEmpty(text2))
             {
                 return true;
             }
             if (text2 == "WindowsPhone")
             {
                 targetFramework = TargetFrameworkId.Phone;
                 targetFrameworkVersion = 70000;
                 return true;
             }
             if (text2 == "WindowsPhone71")
             {
                 targetFramework = TargetFrameworkId.Phone;
                 targetFrameworkVersion = 70100;
                 return true;
             }
             if (text2 == "WindowsPhone8")
             {
                 targetFramework = TargetFrameworkId.Phone;
                 targetFrameworkVersion = 80000;
                 return true;
             }
             if (text2.StartsWith("WindowsPhone", StringComparison.Ordinal))
             {
                 targetFramework = TargetFrameworkId.Unrecognized;
                 targetFrameworkVersion = 70100;
                 return true;
             }
             targetFramework = TargetFrameworkId.Unrecognized;
             return true;
         }
     }
     targetFramework = TargetFrameworkId.Unrecognized;
     return true;
 }
Example #26
0
        // If this doesn't work, perhaps we could fall back to parsing the metadata version number.
        private static bool ParseTargetFrameworkMonikerIntoEnum(String targetFrameworkMoniker, out TargetFrameworkId targetFramework, out int targetFrameworkVersion)
        {
            Contract.Requires(!String.IsNullOrEmpty(targetFrameworkMoniker));

            targetFramework        = TargetFrameworkId.NotYetChecked;
            targetFrameworkVersion = 0;

            String identifier = null;
            String profile    = null;

            ParseFrameworkName(targetFrameworkMoniker, out identifier, out targetFrameworkVersion, out profile);

            switch (identifier)
            {
            case ".NETFramework":
                targetFramework = TargetFrameworkId.NetFramework;
                break;

            case ".NETPortable":
                targetFramework = TargetFrameworkId.Portable;
                break;

            case ".NETCore":
                targetFramework = TargetFrameworkId.NetCore;
                break;

            case "WindowsPhone":
                if (targetFrameworkVersion >= 80100)
                {
                    // A TFM of the form WindowsPhone,Version=v8.1 corresponds to SL 8.1 scenario
                    // and gets the same quirks as WindowsPhoneApp\v8.1 store apps.
                    targetFramework = TargetFrameworkId.Phone;
                }
                else
                {
                    // There is no TFM for Apollo or below and hence we assign the targetFramework to Unspecified.
                    targetFramework = TargetFrameworkId.Unspecified;
                }
                break;

            case "WindowsPhoneApp":
                targetFramework = TargetFrameworkId.Phone;
                break;

            case "Silverlight":
                targetFramework = TargetFrameworkId.Silverlight;
                // Windows Phone 7 is Silverlight,Version=v4.0,Profile=WindowsPhone
                // Windows Phone 7.1 is Silverlight,Version=v4.0,Profile=WindowsPhone71
                if (!String.IsNullOrEmpty(profile))
                {
                    if (profile == "WindowsPhone")
                    {
                        targetFramework        = TargetFrameworkId.Phone;
                        targetFrameworkVersion = 70000;
                    }
                    else if (profile == "WindowsPhone71")
                    {
                        targetFramework        = TargetFrameworkId.Phone;
                        targetFrameworkVersion = 70100;
                    }
                    else if (profile == "WindowsPhone8")      // @
                    {
                        targetFramework        = TargetFrameworkId.Phone;
                        targetFrameworkVersion = 80000;
                    }
                    else if (profile.StartsWith("WindowsPhone", StringComparison.Ordinal))
                    {
                        Contract.Assert(false, "This is a phone app, but we can't tell what version this is!");
                        targetFramework        = TargetFrameworkId.Unrecognized;
                        targetFrameworkVersion = 70100;
                    }
                    else
                    {
                        Contract.Assert(false, String.Format(CultureInfo.InvariantCulture, "Unrecognized Silverlight profile \"{0}\".  What is this, an XBox app?", profile));
                        targetFramework = TargetFrameworkId.Unrecognized;
                    }
                }
                break;

            default:
                Contract.Assert(false, String.Format(CultureInfo.InvariantCulture, "Unrecognized Target Framework Moniker in our Binary Compatibility class.  Framework name: \"{0}\"", targetFrameworkMoniker));
                targetFramework = TargetFrameworkId.Unrecognized;
                break;
            }

            return(true);
        }
        // If this doesn't work, perhaps we could fall back to parsing the metadata version number.
        private static bool ParseTargetFrameworkMonikerIntoEnum(String targetFrameworkMoniker, out TargetFrameworkId targetFramework, out int targetFrameworkVersion)
        {
            Contract.Requires(!String.IsNullOrEmpty(targetFrameworkMoniker));

            targetFramework = TargetFrameworkId.NotYetChecked;
            targetFrameworkVersion = 0;

            String identifier = null;
            String profile = null;
            ParseFrameworkName(targetFrameworkMoniker, out identifier, out targetFrameworkVersion, out profile);

            switch (identifier)
            {
                case ".NETFramework":
                    targetFramework = TargetFrameworkId.NetFramework;
                    break;

                case ".NETPortable":
                    targetFramework = TargetFrameworkId.Portable;
                    break;

                case ".NETCore":
                    targetFramework = TargetFrameworkId.NetCore;
                    break;

                case "Silverlight":
                    targetFramework = TargetFrameworkId.Silverlight;
                    // Windows Phone 7 is Silverlight,Version=v4.0,Profile=WindowsPhone
                    // Windows Phone 7.1 is Silverlight,Version=v4.0,Profile=WindowsPhone71
                    if (!String.IsNullOrEmpty(profile))
                    {
                        if (profile == "WindowsPhone")
                        {
                            targetFramework = TargetFrameworkId.Phone;
                            targetFrameworkVersion = 70000;
                        }
                        else if (profile == "WindowsPhone71")
                        {
                            targetFramework = TargetFrameworkId.Phone;
                            targetFrameworkVersion = 70100;
                        }
                        else if (profile == "WindowsPhone8")  // @
                        {
                            targetFramework = TargetFrameworkId.Phone;
                            targetFrameworkVersion = 80000;
                        }
                        else if (profile.StartsWith("WindowsPhone", StringComparison.Ordinal))
                        {
                            Contract.Assert(false, "This is a phone app, but we can't tell what version this is!");
                            targetFramework = TargetFrameworkId.Unrecognized;
                            targetFrameworkVersion = 70100;
                        }
                        else
                        {
                            Contract.Assert(false, String.Format(CultureInfo.InvariantCulture, "Unrecognized Silverlight profile \"{0}\".  What is this, an XBox app?", profile));
                            targetFramework = TargetFrameworkId.Unrecognized;
                        }
                    }
                    break;

                default:
                    Contract.Assert(false, String.Format(CultureInfo.InvariantCulture, "Unrecognized Target Framework Moniker in our Binary Compatibility class.  Framework name: \"{0}\"", targetFrameworkMoniker));
                    targetFramework = TargetFrameworkId.Unrecognized;
                    break;
            }

            return true;
        }
Example #28
0
        private static bool ParseTargetFrameworkMonikerIntoEnum(string targetFrameworkMoniker, out TargetFrameworkId targetFramework, out int targetFrameworkVersion)
        {
            targetFramework        = TargetFrameworkId.NotYetChecked;
            targetFrameworkVersion = 0;
            string text  = null;
            string text2 = null;

            BinaryCompatibility.ParseFrameworkName(targetFrameworkMoniker, out text, out targetFrameworkVersion, out text2);
            string a;

            if ((a = text) != null)
            {
                if (a == ".NETFramework")
                {
                    targetFramework = TargetFrameworkId.NetFramework;
                    return(true);
                }
                if (a == ".NETPortable")
                {
                    targetFramework = TargetFrameworkId.Portable;
                    return(true);
                }
                if (a == ".NETCore")
                {
                    targetFramework = TargetFrameworkId.NetCore;
                    return(true);
                }
                if (a == "Silverlight")
                {
                    targetFramework = TargetFrameworkId.Silverlight;
                    if (string.IsNullOrEmpty(text2))
                    {
                        return(true);
                    }
                    if (text2 == "WindowsPhone")
                    {
                        targetFramework        = TargetFrameworkId.Phone;
                        targetFrameworkVersion = 70000;
                        return(true);
                    }
                    if (text2 == "WindowsPhone71")
                    {
                        targetFramework        = TargetFrameworkId.Phone;
                        targetFrameworkVersion = 70100;
                        return(true);
                    }
                    if (text2 == "WindowsPhone8")
                    {
                        targetFramework        = TargetFrameworkId.Phone;
                        targetFrameworkVersion = 80000;
                        return(true);
                    }
                    if (text2.StartsWith("WindowsPhone", StringComparison.Ordinal))
                    {
                        targetFramework        = TargetFrameworkId.Unrecognized;
                        targetFrameworkVersion = 70100;
                        return(true);
                    }
                    targetFramework = TargetFrameworkId.Unrecognized;
                    return(true);
                }
            }
            targetFramework = TargetFrameworkId.Unrecognized;
            return(true);
        }
        private static bool IsAppUnderSL81CompatMode()
        {
            Contract.Assert(s_AppWasBuiltForFramework == TargetFrameworkId.NotYetChecked);

            if (CompatibilitySwitches.IsAppSilverlight81)
            {
                // This is an SL8.1 scenario and hence it gets the same quirks as WPBlue+ settings.
                s_AppWasBuiltForFramework = TargetFrameworkId.Phone;
                s_AppWasBuiltForVersion = 80100;

                return true;
            }

            return false;
        }
Example #30
0
        private static bool ParseTargetFrameworkMonikerIntoEnum(string targetFrameworkMoniker, out TargetFrameworkId targetFramework, out int targetFrameworkVersion)
        {
            targetFramework        = TargetFrameworkId.NotYetChecked;
            targetFrameworkVersion = 0;
            string identifier = (string)null;
            string profile    = (string)null;

            BinaryCompatibility.ParseFrameworkName(targetFrameworkMoniker, out identifier, out targetFrameworkVersion, out profile);
            if (!(identifier == ".NETFramework"))
            {
                if (!(identifier == ".NETPortable"))
                {
                    if (!(identifier == ".NETCore"))
                    {
                        if (!(identifier == "WindowsPhone"))
                        {
                            if (!(identifier == "WindowsPhoneApp"))
                            {
                                if (identifier == "Silverlight")
                                {
                                    targetFramework = TargetFrameworkId.Silverlight;
                                    if (!string.IsNullOrEmpty(profile))
                                    {
                                        if (profile == "WindowsPhone")
                                        {
                                            targetFramework        = TargetFrameworkId.Phone;
                                            targetFrameworkVersion = 70000;
                                        }
                                        else if (profile == "WindowsPhone71")
                                        {
                                            targetFramework        = TargetFrameworkId.Phone;
                                            targetFrameworkVersion = 70100;
                                        }
                                        else if (profile == "WindowsPhone8")
                                        {
                                            targetFramework        = TargetFrameworkId.Phone;
                                            targetFrameworkVersion = 80000;
                                        }
                                        else if (profile.StartsWith("WindowsPhone", StringComparison.Ordinal))
                                        {
                                            targetFramework        = TargetFrameworkId.Unrecognized;
                                            targetFrameworkVersion = 70100;
                                        }
                                        else
                                        {
                                            targetFramework = TargetFrameworkId.Unrecognized;
                                        }
                                    }
                                }
                                else
                                {
                                    targetFramework = TargetFrameworkId.Unrecognized;
                                }
                            }
                            else
                            {
                                targetFramework = TargetFrameworkId.Phone;
                            }
                        }
                        else
                        {
                            targetFramework = targetFrameworkVersion < 80100 ? TargetFrameworkId.Unspecified : TargetFrameworkId.Phone;
                        }
                    }
                    else
                    {
                        targetFramework = TargetFrameworkId.NetCore;
                    }
                }
                else
                {
                    targetFramework = TargetFrameworkId.Portable;
                }
            }
            else
            {
                targetFramework = TargetFrameworkId.NetFramework;
            }
            return(true);
        }
Example #31
0
        // If this doesn't work, perhaps we could fall back to parsing the metadata version number.
        private static bool ParseTargetFrameworkMonikerIntoEnum(String targetFrameworkMoniker, out TargetFrameworkId targetFramework, out int targetFrameworkVersion)
        {
            Contract.Requires(!String.IsNullOrEmpty(targetFrameworkMoniker));

            targetFramework = TargetFrameworkId.NotYetChecked;
            targetFrameworkVersion = 0;

            String identifier = null;
            String profile = null;
            ParseFrameworkName(targetFrameworkMoniker, out identifier, out targetFrameworkVersion, out profile);

            switch (identifier)
            {
                case ".NETFramework":
                    targetFramework = TargetFrameworkId.NetFramework;
                    break;

                case ".NETPortable":
                    targetFramework = TargetFrameworkId.Portable;
                    break;

                case ".NETCore":
                    targetFramework = TargetFrameworkId.NetCore;
                    break;

                case "WindowsPhone":
                    if (targetFrameworkVersion >= 80100)
                    {
                        // A TFM of the form WindowsPhone,Version=v8.1 corresponds to SL 8.1 scenario
                        // and gets the same quirks as WindowsPhoneApp\v8.1 store apps.
                        targetFramework = TargetFrameworkId.Phone;
                    }
                    else
                    {
                        // There is no TFM for Apollo or below and hence we assign the targetFramework to Unspecified. 
                        targetFramework = TargetFrameworkId.Unspecified;
                    }
                    break;

                case "WindowsPhoneApp":
                    targetFramework = TargetFrameworkId.Phone;
                    break;

                case "Silverlight":
                    targetFramework = TargetFrameworkId.Silverlight;
                    // Windows Phone 7 is Silverlight,Version=v4.0,Profile=WindowsPhone
                    // Windows Phone 7.1 is Silverlight,Version=v4.0,Profile=WindowsPhone71
                    if (!String.IsNullOrEmpty(profile))
                    {
                        if (profile == "WindowsPhone")
                        {
                            targetFramework = TargetFrameworkId.Phone;
                            targetFrameworkVersion = 70000;
                        }
                        else if (profile == "WindowsPhone71")
                        {
                            targetFramework = TargetFrameworkId.Phone;
                            targetFrameworkVersion = 70100;
                        }
                        else if (profile == "WindowsPhone8") 
                        {
                            targetFramework = TargetFrameworkId.Phone;
                            targetFrameworkVersion = 80000;
                        }
                        else if (profile.StartsWith("WindowsPhone", StringComparison.Ordinal))
                        {
                            Contract.Assert(false, "This is a phone app, but we can't tell what version this is!");
                            targetFramework = TargetFrameworkId.Unrecognized;
                            targetFrameworkVersion = 70100;
                        }
                        else
                        {
                            Contract.Assert(false, String.Format(CultureInfo.InvariantCulture, "Unrecognized Silverlight profile \"{0}\".  What is this, an XBox app?", profile));
                            targetFramework = TargetFrameworkId.Unrecognized;
                        }
                    }
                    break;

                default:
                    Contract.Assert(false, String.Format(CultureInfo.InvariantCulture, "Unrecognized Target Framework Moniker in our Binary Compatibility class.  Framework name: \"{0}\"", targetFrameworkMoniker));
                    targetFramework = TargetFrameworkId.Unrecognized;
                    break;
            }

            return true;
        }
Example #32
0
 private static bool ReferencesAssembly(IProject project, TargetFrameworkId targetFrameworkId, AssemblyNameInfo name)
 {
     return(ReferencedAssembliesService.IsProjectReferencingAssemblyByName(project,
                                                                           targetFrameworkId, name, out var _));
 }
        private static void ReadTargetFrameworkId()
        {
            String targetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();
            // Write to a local then to _targetFramework, after writing the version number.
            TargetFrameworkId fxId;
            int fxVersion = 0;
            if (targetFrameworkName == null)
                fxId = TargetFrameworkId.Unspecified;
            else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
                fxId = TargetFrameworkId.Unrecognized;

            s_AppWasBuiltForFramework = fxId;
            s_AppWasBuiltForVersion = fxVersion;
        }
Example #34
0
 internal T4ResolveProjectProperties([NotNull] PlatformID platformID, [NotNull] TargetFrameworkId targetFrameworkId)
     : base(EmptyList <Guid> .InstanceList, platformID, Guid.Empty, new[] { targetFrameworkId }, dotNetCoreSDK: null)
 {
 }
        private static void ReadTargetFrameworkId()
        {
#if FEATURE_CORECLR
            if (IsAppUnderSL81CompatMode())
            {
                // Since the SL does not have any Main() the reading of the TFM will not work and as a workaround we use the CompatibilitySwitch.IsAppSilverlight81 
                // to identify if the given app targets SL 8.1 and accordingly give it the value TargetFrameworkId.Phone;80100

                // PS - This also means that the CompatMode set by AppDomain m_compatFlags with AppDomainCompatMode.APPDOMAINCOMPAT_APP_SL81
                // will override any other mechanism like TFM, RegistryKey, env variable or config file settings. Since this option
                // is only used by SL8.1 scenario's I don't think this is an issue and is rather desirable.

                return;
            }
#endif //FEATURE_CORECLR
            String targetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();

            var overrideValue = System.Runtime.Versioning.CompatibilitySwitch.GetValueInternal("TargetFrameworkMoniker");
            if (!string.IsNullOrEmpty(overrideValue))
            {
                targetFrameworkName = overrideValue;
            }

            // Write to a local then to _targetFramework, after writing the version number.
            TargetFrameworkId fxId;
            int fxVersion = 0;
            if (targetFrameworkName == null)
            {
#if FEATURE_CORECLR
                // if we don't have a value for targetFrameworkName we need to figure out if we should give the newest behavior or not.
                if (CompatibilitySwitches.UseLatestBehaviorWhenTFMNotSpecified)
                {
                    fxId = TargetFrameworkId.NetFramework;
                    fxVersion = 50000; // We are going to default to the latest value for version that we have in our code.
                }
                else
#endif
                    fxId = TargetFrameworkId.Unspecified;
            }
            else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
                fxId = TargetFrameworkId.Unrecognized;

            s_AppWasBuiltForFramework = fxId;
            s_AppWasBuiltForVersion = fxVersion;
        }
Example #36
0
            private void AddQuirksForFramework(TargetFrameworkId builtAgainstFramework, int buildAgainstVersion)
            {
                switch (builtAgainstFramework)
                {
                case TargetFrameworkId.NotYetChecked:
                case TargetFrameworkId.Unrecognized:
                case TargetFrameworkId.Unspecified:
                case TargetFrameworkId.Portable:
                    break;

                case TargetFrameworkId.NetFramework:
                case TargetFrameworkId.NetCore:
                    if (buildAgainstVersion >= 50000)
                    {
                        this.TargetsAtLeast_Desktop_V5_0 = true;
                    }
                    if (buildAgainstVersion >= 40504)
                    {
                        this.TargetsAtLeast_Desktop_V4_5_4 = true;
                    }
                    if (buildAgainstVersion >= 40503)
                    {
                        this.TargetsAtLeast_Desktop_V4_5_3 = true;
                    }
                    if (buildAgainstVersion >= 40502)
                    {
                        this.TargetsAtLeast_Desktop_V4_5_2 = true;
                    }
                    if (buildAgainstVersion >= 40501)
                    {
                        this.TargetsAtLeast_Desktop_V4_5_1 = true;
                    }
                    if (buildAgainstVersion >= 40500)
                    {
                        this.TargetsAtLeast_Desktop_V4_5 = true;
                        this.AddQuirksForFramework(TargetFrameworkId.Phone, 70100);
                        this.AddQuirksForFramework(TargetFrameworkId.Silverlight, 50000);
                        return;
                    }
                    break;

                case TargetFrameworkId.Silverlight:
                    if (buildAgainstVersion >= 40000)
                    {
                        this.TargetsAtLeast_Silverlight_V4 = true;
                    }
                    if (buildAgainstVersion >= 50000)
                    {
                        this.TargetsAtLeast_Silverlight_V5 = true;
                    }
                    if (buildAgainstVersion >= 60000)
                    {
                        this.TargetsAtLeast_Silverlight_V6 = true;
                    }
                    break;

                case TargetFrameworkId.Phone:
                    if (buildAgainstVersion >= 80000)
                    {
                        this.TargetsAtLeast_Phone_V8_0 = true;
                    }
                    if (buildAgainstVersion >= 710)
                    {
                        this.TargetsAtLeast_Phone_V7_1 = true;
                        return;
                    }
                    break;

                default:
                    return;
                }
            }
Example #37
0
        private static void ReadTargetFrameworkId()
        {
            String targetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();

            var overrideValue = System.Runtime.Versioning.CompatibilitySwitch.GetValueInternal("TargetFrameworkMoniker");
            if (!string.IsNullOrEmpty(overrideValue))
            {
                targetFrameworkName = overrideValue;
            }

            // Write to a local then to _targetFramework, after writing the version number.
            TargetFrameworkId fxId;
            int fxVersion = 0;
            if (targetFrameworkName == null)
            {
                fxId = TargetFrameworkId.Unspecified;
            }
            else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
                fxId = TargetFrameworkId.Unrecognized;

            s_AppWasBuiltForFramework = fxId;
            s_AppWasBuiltForVersion = fxVersion;
        }
Example #38
0
            private void AddQuirksForFramework(TargetFrameworkId builtAgainstFramework, int buildAgainstVersion)
            {
                switch (builtAgainstFramework)
                {
                case TargetFrameworkId.NetFramework:
                case TargetFrameworkId.NetCore:
                    if (buildAgainstVersion >= 50000)
                    {
                        this.TargetsAtLeast_Desktop_V5_0 = true;
                    }
                    if (buildAgainstVersion >= 40504)
                    {
                        this.TargetsAtLeast_Desktop_V4_5_4 = true;
                    }
                    if (buildAgainstVersion >= 40503)
                    {
                        this.TargetsAtLeast_Desktop_V4_5_3 = true;
                    }
                    if (buildAgainstVersion >= 40502)
                    {
                        this.TargetsAtLeast_Desktop_V4_5_2 = true;
                    }
                    if (buildAgainstVersion >= 40501)
                    {
                        this.TargetsAtLeast_Desktop_V4_5_1 = true;
                    }
                    if (buildAgainstVersion < 40500)
                    {
                        break;
                    }
                    this.TargetsAtLeast_Desktop_V4_5 = true;
                    this.AddQuirksForFramework(TargetFrameworkId.Phone, 70100);
                    this.AddQuirksForFramework(TargetFrameworkId.Silverlight, 50000);
                    break;

                case TargetFrameworkId.Silverlight:
                    if (buildAgainstVersion >= 40000)
                    {
                        this.TargetsAtLeast_Silverlight_V4 = true;
                    }
                    if (buildAgainstVersion >= 50000)
                    {
                        this.TargetsAtLeast_Silverlight_V5 = true;
                    }
                    if (buildAgainstVersion < 60000)
                    {
                        break;
                    }
                    this.TargetsAtLeast_Silverlight_V6 = true;
                    break;

                case TargetFrameworkId.Phone:
                    if (buildAgainstVersion >= 80000)
                    {
                        this.TargetsAtLeast_Phone_V8_0 = true;
                    }
                    if (buildAgainstVersion >= 80100)
                    {
                        this.TargetsAtLeast_Desktop_V4_5   = true;
                        this.TargetsAtLeast_Desktop_V4_5_1 = true;
                    }
                    if (buildAgainstVersion < 710)
                    {
                        break;
                    }
                    this.TargetsAtLeast_Phone_V7_1 = true;
                    break;
                }
            }
Example #39
0
            // The purpose of this method is to capture information about integrations & behavioral compatibility
            // between our multiple different release vehicles.  IE, if a behavior shows up in Silverlight version 5,
            // does it show up in the .NET Framework version 4.5 and Windows Phone 8?
            // Version number is major * 10000 + minor * 100 + build (ie, 4.5.1.0 would be version 40501).
            private void AddQuirksForFramework(TargetFrameworkId builtAgainstFramework, int buildAgainstVersion)
            {
                Contract.Requires(buildAgainstVersion > 0 || builtAgainstFramework == TargetFrameworkId.Unspecified);

                switch (builtAgainstFramework)
                {
                case TargetFrameworkId.NetFramework:
                case TargetFrameworkId.NetCore:       // Treat Windows 8 tailored apps as normal desktop apps - same product
                    if (buildAgainstVersion >= 50000)
                    {
                        TargetsAtLeast_Desktop_V5_0 = true;
                    }

                    // Potential 4.5 servicing releases
                    if (buildAgainstVersion >= 40504)
                    {
                        TargetsAtLeast_Desktop_V4_5_4 = true;
                    }
                    if (buildAgainstVersion >= 40503)
                    {
                        TargetsAtLeast_Desktop_V4_5_3 = true;
                    }
                    if (buildAgainstVersion >= 40502)
                    {
                        TargetsAtLeast_Desktop_V4_5_2 = true;
                    }
                    if (buildAgainstVersion >= 40501)
                    {
                        TargetsAtLeast_Desktop_V4_5_1 = true;
                    }

                    if (buildAgainstVersion >= 40500)
                    {
                        TargetsAtLeast_Desktop_V4_5 = true;
                        // On XX/XX/XX we integrated all changes from the phone V7_1 into the branch from which contains Desktop V4_5, thus
                        // Any application built for V4_5 (or above) should have all the quirks for Phone V7_1 turned on.
                        AddQuirksForFramework(TargetFrameworkId.Phone, 70100);
                        // All Silverlight 5 behavior should be in the .NET Framework version 4.5
                        AddQuirksForFramework(TargetFrameworkId.Silverlight, 50000);
                    }
                    break;

                case TargetFrameworkId.Phone:
                    if (buildAgainstVersion >= 80000)
                    {
                        // This is for Apollo apps. For Apollo apps we don't want to enable any of the 4.5 or 4.5.1 quirks
                        TargetsAtLeast_Phone_V8_0 = true;
                        //TargetsAtLeast_Desktop_V4_5 = true;
                    }
                    if (buildAgainstVersion >= 80100)
                    {
                        // For WindowsPhone 8.1 and SL 8.1 scenarios we want to enable both 4.5 and 4.5.1 quirks.
                        TargetsAtLeast_Desktop_V4_5   = true;
                        TargetsAtLeast_Desktop_V4_5_1 = true;
                    }

                    if (buildAgainstVersion >= 710)
                    {
                        TargetsAtLeast_Phone_V7_1 = true;
                    }
                    break;

                case TargetFrameworkId.Silverlight:
                    if (buildAgainstVersion >= 40000)
                    {
                        TargetsAtLeast_Silverlight_V4 = true;
                    }

                    if (buildAgainstVersion >= 50000)
                    {
                        TargetsAtLeast_Silverlight_V5 = true;
                    }

                    if (buildAgainstVersion >= 60000)
                    {
                        TargetsAtLeast_Silverlight_V6 = true;
                        // @
                    }
                    break;

                case TargetFrameworkId.Unspecified:
                    break;

                case TargetFrameworkId.NotYetChecked:
                case TargetFrameworkId.Unrecognized:
                    Contract.Assert(false, "Bad framework kind");
                    break;

                default:
                    Contract.Assert(false, "Error: we introduced a new Target Framework but did not update our binary compatibility map");
                    break;
                }
            }
Example #40
0
        private static void ReadTargetFrameworkId()
        {
            String targetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();

            var overrideValue = System.Runtime.Versioning.CompatibilitySwitch.GetValueInternal("TargetFrameworkMoniker");
            if (!string.IsNullOrEmpty(overrideValue))
            {
                targetFrameworkName = overrideValue;
            }

            // Write to a local then to _targetFramework, after writing the version number.
            TargetFrameworkId fxId;
            int fxVersion = 0;
            if (targetFrameworkName == null)
            {
#if FEATURE_CORECLR
                // We are going to default to the latest value for version that we have in our code.
                fxId = TargetFrameworkId.NetFramework;
                fxVersion = 50000; 
#else
                fxId = TargetFrameworkId.Unspecified;
#endif
            }
            else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
                fxId = TargetFrameworkId.Unrecognized;

            s_AppWasBuiltForFramework = fxId;
            s_AppWasBuiltForVersion = fxVersion;
        }
Example #41
0
 public UnitTestElementId CreateId(IProject project, TargetFrameworkId targetFrameworkId, string id)
 {
     return(_elementIdFactory.Create(_provider, project, targetFrameworkId, id));
 }
Example #42
0
 public TargetFrameworkScope GetTargetFramework(TargetFrameworkId targetFrameworkId)
 => _targetFrameworkReferences.GetScope(targetFrameworkId);