Пример #1
0
        public override void CreateFile()
        {
            using (FileStream fs = Open(FileMode.Create, FileAccess.Write, FileShare.Read))
            {
                if (propertiesPath == null)
                {
                    propertiesPath = new PathDescriptor(location, "Properties");
                }

                StreamWriter sw = new StreamWriter(fs);
                sw.WriteLine("<Project ToolsVersion=\"{0}\" DefaultTargets=\"{1}\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">", VisualStudioUtils.GetToolsVersion(version), "Build");

                SetConfigHeader(sw);
                SetBuildTargets(sw);
                SetReferences(sw);
                SetSourceFiles(sw);
                SetEmbeddedResources(sw);

                sw.WriteLine("  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />");
                sw.WriteLine("</Project>");
                sw.Flush();
            }
        }
Пример #2
0
        public override void CreateFile()
        {
            if (!Application.BuildDirectory.Exists())
            {
                Application.BuildDirectory.CreateHidden();
            }

            using (FileStream fs = Open(FileMode.Create, FileAccess.Write, FileShare.Read))
            {
                StreamWriter sw = new StreamWriter(fs);
                sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                sw.WriteLine("<Project ToolsVersion=\"{0}\" DefaultTargets=\"{1}\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">", VisualStudioUtils.GetToolsVersion(version), "Build");
                sw.WriteLine("  <PropertyGroup Label=\"Globals\">");
                sw.WriteLine("    <ProjectGuid>{0}</ProjectGuid>", projectGuid.ToString("B").ToUpperInvariant());
                sw.WriteLine("  </PropertyGroup>");

                SetBuildTargets(sw);
                SetProjectFiles(sw);
                SetTargetConfiguration(sw);
                SetTargetImports(sw);

                sw.WriteLine("</Project>");
                sw.Flush();
            }
            using (FileStream fs = new FileDescriptor(location, "{0}.filters", FullName).Open(FileMode.Create, FileAccess.Write, FileShare.Read))
            {
                StreamWriter sw = new StreamWriter(fs);
                sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                sw.WriteLine("<Project ToolsVersion=\"{0}\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">", VisualStudioUtils.GetToolsVersion(version));

                sw.WriteLine("  <ItemGroup>");
                SetFilterDirectories(location, sw);
                sw.WriteLine("  </ItemGroup>");
                SetFilterFiles(sw);

                sw.WriteLine("</Project>");
                sw.Flush();
            }
        }