Esempio n. 1
0
        public override void Process(
            string sourcePath,
            ProjectRootElement project,
            Dictionary <string, ProjectPropertyGroupElement> groups
            )
        {
            ProjectPropertyGroupElement globals;

            if (!groups.TryGetValue("Globals", out globals))
            {
                globals = project.AddPropertyGroup();
            }

            AddOrSetProperty(globals, "StartupFile", "manage.py");
            AddOrSetProperty(globals, "ProjectTypeGuids", "{5F0BE9CA-D677-4A4D-8806-6076C0FAAD37};{349c5851-65df-11da-9384-00065b846f21};{888888a0-9f3d-457c-b088-3a5042f75d52}");
            AddOrSetProperty(globals, "LaunchProvider", "Django launcher");
            AddOrSetProperty(globals, "WebBrowserUrl", "http://localhost");

            var settingsFilePath = PathUtils.FindFile(sourcePath, "settings.py", depthLimit: 1);

            if (File.Exists(settingsFilePath))
            {
                var packageName = PathUtils.GetLastDirectoryName(settingsFilePath);
                AddOrSetProperty(globals, "DjangoSettingsModule", "{0}.settings".FormatInvariant(packageName));
            }

            project.AddImport(@"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.Django.targets");

            GenericWebProjectCustomization.AddWebProjectExtensions(project);
        }
Esempio n. 2
0
        public override void Process(
            string sourcePath,
            ProjectRootElement project,
            Dictionary <string, ProjectPropertyGroupElement> groups
            )
        {
            ProjectPropertyGroupElement globals;

            if (!groups.TryGetValue("Globals", out globals))
            {
                globals = project.AddPropertyGroup();
            }

            AddOrSetProperty(globals, "ProjectTypeGuids", "{1b580a1a-fdb3-4b32-83e1-6407eb2722e6};{349c5851-65df-11da-9384-00065b846f21};{888888a0-9f3d-457c-b088-3a5042f75d52}");
            AddOrSetProperty(globals, "LaunchProvider", PythonConstants.WebLauncherName);
            AddOrSetProperty(globals, "WebBrowserUrl", "http://localhost");

            project.AddImport(@"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.Web.targets");

            GenericWebProjectCustomization.AddWebProjectExtensions(project);
        }