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();
        }
Example #2
0
        public override void UpgradeProject(CompilerVersion newVersion, TargetFramework newFramework)
        {
            if (!Project.ReadOnly)
            {
                lock (Project.SyncRoot)
                {
                    TargetFramework oldFramework = Project.CurrentTargetFramework;
                    if (newVersion != null && GetAvailableCompilerVersions().Contains(newVersion))
                    {
                        Project.SetToolsVersion(newVersion.MSBuildVersion.Major + "." + newVersion.MSBuildVersion.Minor);
                    }
                    if (newFramework != null)
                    {
                        UpdateAppConfig(newFramework);

                        ClientProfileTargetFramework clientProfile = newFramework as ClientProfileTargetFramework;
                        if (clientProfile != null)
                        {
                            newFramework = clientProfile.FullFramework;
                            ((MSBuildBasedProject)Project).SetProperty(null, null, "TargetFrameworkProfile", "Client", PropertyStorageLocations.Base, true);
                        }
                        else
                        {
                            ((MSBuildBasedProject)Project).SetProperty(null, null, "TargetFrameworkProfile", "", PropertyStorageLocations.Base, true);
                        }
                        ((MSBuildBasedProject)Project).SetProperty(null, null, "TargetFrameworkVersion", newFramework.Name, PropertyStorageLocations.Base, true);

                        if (oldFramework is ClientProfileTargetFramework)
                        {
                            oldFramework = ((ClientProfileTargetFramework)oldFramework).FullFramework;
                        }

                        if (oldFramework != null && !oldFramework.IsBasedOn(TargetFramework.Net35) && newFramework.IsBasedOn(TargetFramework.Net35))
                        {
                            AddDotnet35References();
                        }
                        else if (oldFramework != null && oldFramework.IsBasedOn(TargetFramework.Net35) && !newFramework.IsBasedOn(TargetFramework.Net35))
                        {
                            RemoveDotnet35References();
                        }

                        if (oldFramework != null && !oldFramework.IsBasedOn(TargetFramework.Net40) && newFramework.IsBasedOn(TargetFramework.Net40))
                        {
                            AddDotnet40References();
                        }
                        else if (oldFramework != null && oldFramework.IsBasedOn(TargetFramework.Net40) && !newFramework.IsBasedOn(TargetFramework.Net40))
                        {
                            RemoveDotnet40References();
                        }
                    }
                    AddOrRemoveExtensions();
                    Project.Save();
                    //TODO: Uncomment
                    // ResXConverter.UpdateResourceFiles(Project);
                }
            }
        }
        public virtual void UpgradeProject(CompilerVersion newVersion, TargetFramework newFramework)
        {
            if (!this.ReadOnly)
            {
                lock (SyncRoot) {
                    TargetFramework oldFramework = this.CurrentTargetFramework;
                    if (newVersion != null && GetAvailableCompilerVersions().Contains(newVersion))
                    {
                        SetToolsVersion(newVersion.MSBuildVersion.Major + "." + newVersion.MSBuildVersion.Minor);
                    }
                    if (newFramework != null)
                    {
                        UpdateAppConfig(newFramework);

                        ClientProfileTargetFramework clientProfile = newFramework as ClientProfileTargetFramework;
                        if (clientProfile != null)
                        {
                            newFramework = clientProfile.FullFramework;
                            SetProperty(null, null, "TargetFrameworkProfile", "Client", PropertyStorageLocations.Base, true);
                        }
                        else
                        {
                            SetProperty(null, null, "TargetFrameworkProfile", "", PropertyStorageLocations.Base, true);
                        }
                        SetProperty(null, null, "TargetFrameworkVersion", newFramework.Name, PropertyStorageLocations.Base, true);

                        if (oldFramework is ClientProfileTargetFramework)
                        {
                            oldFramework = ((ClientProfileTargetFramework)oldFramework).FullFramework;
                        }

                        if (oldFramework != null && !oldFramework.IsBasedOn(TargetFramework.Net35) && newFramework.IsBasedOn(TargetFramework.Net35))
                        {
                            AddDotnet35References();
                        }
                        else if (oldFramework != null && oldFramework.IsBasedOn(TargetFramework.Net35) && !newFramework.IsBasedOn(TargetFramework.Net35))
                        {
                            RemoveDotnet35References();
                        }

                        if (oldFramework != null && !oldFramework.IsBasedOn(TargetFramework.Net40) && newFramework.IsBasedOn(TargetFramework.Net40))
                        {
                            AddDotnet40References();
                        }
                        else if (oldFramework != null && oldFramework.IsBasedOn(TargetFramework.Net40) && !newFramework.IsBasedOn(TargetFramework.Net40))
                        {
                            RemoveDotnet40References();
                        }
                    }
                    AddOrRemoveExtensions();
                    Save();
                }
            }
        }
Example #4
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);
            }
            base.ProjectCreationComplete();
        }
Example #5
0
		public override void UpgradeProject(CompilerVersion newVersion, TargetFramework newFramework)
		{
			if (!Project.ReadOnly) {
				lock (Project.SyncRoot) {
					TargetFramework oldFramework = Project.CurrentTargetFramework;
					if (newVersion != null && GetAvailableCompilerVersions().Contains(newVersion)) {
						Project.SetToolsVersion(newVersion.MSBuildVersion.Major + "." + newVersion.MSBuildVersion.Minor);
					}
					if (newFramework != null) {
						UpdateAppConfig(newFramework);
						
						ClientProfileTargetFramework clientProfile = newFramework as ClientProfileTargetFramework;
						if (clientProfile != null) {
							newFramework = clientProfile.FullFramework;
							((MSBuildBasedProject)Project).SetProperty(null, null, "TargetFrameworkProfile", "Client", PropertyStorageLocations.Base, true);
						} else {
							((MSBuildBasedProject)Project).SetProperty(null, null, "TargetFrameworkProfile", "", PropertyStorageLocations.Base, true);
						}
						((MSBuildBasedProject)Project).SetProperty(null, null, "TargetFrameworkVersion", newFramework.Name, PropertyStorageLocations.Base, true);
						
						if (oldFramework is ClientProfileTargetFramework)
							oldFramework = ((ClientProfileTargetFramework)oldFramework).FullFramework;
						
						if (oldFramework != null && !oldFramework.IsBasedOn(TargetFramework.Net35) && newFramework.IsBasedOn(TargetFramework.Net35))
							AddDotnet35References();
						else if (oldFramework != null && oldFramework.IsBasedOn(TargetFramework.Net35) && !newFramework.IsBasedOn(TargetFramework.Net35))
							RemoveDotnet35References();
						
						if (oldFramework != null && !oldFramework.IsBasedOn(TargetFramework.Net40) && newFramework.IsBasedOn(TargetFramework.Net40))
							AddDotnet40References();
						else if (oldFramework != null && oldFramework.IsBasedOn(TargetFramework.Net40) && !newFramework.IsBasedOn(TargetFramework.Net40))
							RemoveDotnet40References();
					}
					AddOrRemoveExtensions();
					Project.Save();
					ResXConverter.UpdateResourceFiles(Project);
				}
			}
		}