예제 #1
0
        public override void ProjectCreationComplete()
        {
            TargetFramework fx = Project.CurrentTargetFramework;

            if (fx != null && (fx.IsBasedOn(TargetFramework.Net35) || fx.IsBasedOn(TargetFramework.Net35Client)))
            {
                AddDotnet35References();
            }
            if (fx != null && (fx.IsBasedOn(TargetFramework.Net40) || fx.IsBasedOn(TargetFramework.Net40Client)))
            {
                AddDotnet40References();
            }
            if (fx != null)
            {
                UpdateAppConfig(fx);
            }
            if (Project.OutputType != OutputType.Library)
            {
                if (DotnetDetection.IsDotnet45Installed() && fx.IsBasedOn(TargetFramework.Net45))
                {
                    Project.SetProperty(null, Project.ActivePlatform, "Prefer32Bit", "True", PropertyStorageLocations.PlatformSpecific, true);
                }
                else
                {
                    Project.SetProperty(null, Project.ActivePlatform, "PlatformTarget", "x86", PropertyStorageLocations.PlatformSpecific, true);
                }
            }
            base.ProjectCreationComplete();
        }
        public void Load(MSBuildBasedProject project, string configuration, string platform)
        {
            int val;

            if (!int.TryParse(BaseAddress.Value, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out val))
            {
                val = 0x400000;
            }
            DllBaseAddress = "0x" + val.ToString("x", NumberFormatInfo.InvariantInfo);

            this.TargetCPU         = new List <KeyItemPair>();
            supports32BitPreferred = false;
            var outputType = projectOptions.GetProperty("OutputType", OutputType.Exe);

            if (DotnetDetection.IsDotnet45Installed() &&
                ((outputType.Value == OutputType.Exe) || (outputType.Value == OutputType.WinExe)))
            {
                var upgradableProject = projectOptions.Project as IUpgradableProject;
                if (upgradableProject != null && upgradableProject.CurrentTargetFramework != null && upgradableProject.CurrentTargetFramework.Supports32BitPreferredOption)
                {
                    supports32BitPreferred = (projectOptions.Project.MinimumSolutionVersion >= SolutionFormatVersion.VS2010);
                }
                // Show 32 vs. 64 options even for library projects;
                // it's relevant for web applications.
            }
            if (supports32BitPreferred)
            {
                this.TargetCPU.Add(new KeyItemPair("AnyCPU32", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any32}")));
                this.TargetCPU.Add(new KeyItemPair("AnyCPU64", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any64}")));
            }
            else
            {
                this.TargetCPU.Add(new KeyItemPair("AnyCPU", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any}")));
            }
            this.TargetCPU.Add(new KeyItemPair("x86", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x86}")));
            this.TargetCPU.Add(new KeyItemPair("x64", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x64}")));
            this.TargetCPU.Add(new KeyItemPair("Itanium", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Itanium}")));

            if (supports32BitPreferred && string.Equals(this.PlatformTarget.Value, "AnyCPU", StringComparison.OrdinalIgnoreCase))
            {
                bool default32BitPreferred = false;
                var  upgradableProject     = projectOptions.Project as IUpgradableProject;
                if (upgradableProject != null && upgradableProject.CurrentTargetFramework.Supports32BitPreferredOption)
                {
                    default32BitPreferred = true;
                }
                if (Prefer32Bit.Value ?? default32BitPreferred)
                {
                    targetCpuComboBox.SelectedValue = "AnyCPU32";
                }
                else
                {
                    targetCpuComboBox.SelectedValue = "AnyCPU64";
                }
            }
            else
            {
                targetCpuComboBox.SelectedValue = this.PlatformTarget.Value;
            }
        }
예제 #3
0
        public void Initialize(ProjectOptionPanel projectOptions)
        {
            if (projectOptions == null)
            {
                throw new ArgumentNullException("projectOptions");
            }
            this.projectOptions = projectOptions;
            projectOptions.RegisterLoadSaveCallback(this);


            this.SerializationInfo = new List <KeyItemPair>();
            this.SerializationInfo.Add(new KeyItemPair("Off", StringParser.Parse("${res:Dialog.ProjectOptions.Build.Off}")));
            this.SerializationInfo.Add(new KeyItemPair("On", StringParser.Parse("${res:Dialog.ProjectOptions.Build.On}")));
            this.SerializationInfo.Add(new KeyItemPair("Auto", StringParser.Parse("${res:Dialog.ProjectOptions.Build.Auto}")));

            this.TargetCPU         = new List <KeyItemPair>();
            supports32BitPreferred = false;
            if (DotnetDetection.IsDotnet45Installed())
            {
                var upgradableProject = projectOptions.Project as IUpgradableProject;
                if (upgradableProject != null && upgradableProject.CurrentTargetFramework.IsBasedOn(TargetFramework.Net45))
                {
                    supports32BitPreferred = projectOptions.Project.MinimumSolutionVersion >= Solution.SolutionVersionVS2010;
                }
                // Show 32 vs. 64 options even for library projects;
                // it's relevant for web applications.
            }
            if (supports32BitPreferred)
            {
                this.TargetCPU.Add(new KeyItemPair("AnyCPU32", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any32}")));
                this.TargetCPU.Add(new KeyItemPair("AnyCPU64", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any64}")));
            }
            else
            {
                this.TargetCPU.Add(new KeyItemPair("AnyCPU", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any}")));
            }
            this.TargetCPU.Add(new KeyItemPair("x86", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x86}")));
            this.TargetCPU.Add(new KeyItemPair("x64", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x64}")));
            this.TargetCPU.Add(new KeyItemPair("Itanium", StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Itanium}")));

            this.FileAlign = new List <KeyItemPair>();
            this.FileAlign.Add(new KeyItemPair("512", "512"));
            this.FileAlign.Add(new KeyItemPair("1024", "1024"));
            this.FileAlign.Add(new KeyItemPair("2048", "2048"));
            this.FileAlign.Add(new KeyItemPair("4096", "4096"));
            this.FileAlign.Add(new KeyItemPair("8192", "8192"));
        }
예제 #4
0
        static bool CheckEnvironment()
        {
            // Safety check: our setup already checks that .NET 4 is installed, but we manually check the .NET version in case SharpDevelop is
            // used on another machine than it was installed on (e.g. "SharpDevelop on USB stick")
            if (!DotnetDetection.IsDotnet45Installed())
            {
                MessageBox.Show("This version of SharpDevelop requires .NET 4.5. You are using: " + Environment.Version, "SharpDevelop");
                return(false);
            }
            // Work around a WPF issue when %WINDIR% is set to an incorrect path
            string windir = Environment.GetFolderPath(Environment.SpecialFolder.Windows, Environment.SpecialFolderOption.DoNotVerify);

            if (Environment.GetEnvironmentVariable("WINDIR") != windir)
            {
                Environment.SetEnvironmentVariable("WINDIR", windir);
            }
            return(true);
        }
        public void GetTypeInheritanceTreeOfClassDerivingFromListOfString()
        {
            if (DotnetDetection.IsDotnet45Installed())
            {
                Assert.Ignore(".NET 4.5 adds IReadOnlyList");
            }
            List <string> results = new List <IReturnType>(
                MemberLookupHelper.GetTypeInheritanceTree(CreateClassDerivingFromListOfString().DefaultReturnType)
                ).ConvertAll <string>(delegate(IReturnType rt) { return(rt.DotNetName); });

            results.Sort();             // order is not guaranteed, so sort for the unit test

            Assert.AreEqual("DerivesFromList;" +
                            "System.Collections.Generic.ICollection{System.String};" +
                            "System.Collections.Generic.IEnumerable{System.String};" +
                            "System.Collections.Generic.IList{System.String};" +
                            "System.Collections.Generic.List{System.String};" +
                            "System.Collections.ICollection;" +
                            "System.Collections.IEnumerable;" +
                            "System.Collections.IList;" +
                            "System.Object",
                            string.Join(";", results.ToArray()));
        }