Exemplo n.º 1
0
        public static IEnumerable <ProjectPublishProfile> GetPublishProfiles(this DotNetProject project)
        {
            var profileFiles = project.GetPublishProfilesDirectory().EnumerateFiles("*.pubxml");

            foreach (var file in profileFiles)
            {
                var profile = ProjectPublishProfile.ReadModel(file.FullName);
                if (profile != null)
                {
                    yield return(profile);
                }
            }
        }
Exemplo n.º 2
0
        public static bool CreatePublishProfileFile(this DotNetProject project, ProjectPublishProfile profile)
        {
            string profileFileContents = ProjectPublishProfile.WriteModel(profile);

            var profileFileName = project.BaseDirectory.Combine("Properties", "PublishProfiles", project.GetNextPubXmlFileName());

            string publishProfilesDirectory = Path.GetDirectoryName(profileFileName);

            Directory.CreateDirectory(publishProfilesDirectory);

            File.WriteAllText(profileFileName, profileFileContents);

            project.AddFile(profileFileName);

            return(true);
        }
Exemplo n.º 3
0
        public void PublishProfilesCanBeRead(string configuration, string platform, string targetFramework, string publishDir)
        {
            var profile = new ProjectPublishProfile {
                LastUsedBuildConfiguration = configuration,
                LastUsedPlatform           = platform,
                TargetFramework            = targetFramework,
                PublishUrl = publishDir
            };

            string tmpFile = Path.GetTempFileName();

            File.WriteAllText(tmpFile, ProjectPublishProfile.WriteModel(profile));

            var readProfile = ProjectPublishProfile.ReadModel(tmpFile);

            Assert.That(profile.LastUsedBuildConfiguration, Is.EqualTo(readProfile.LastUsedBuildConfiguration));
            Assert.That(profile.LastUsedPlatform, Is.EqualTo(readProfile.LastUsedPlatform));
            Assert.That(profile.TargetFramework, Is.EqualTo(readProfile.TargetFramework));
            Assert.That(profile.PublishUrl, Is.EqualTo(readProfile.PublishUrl));
        }
Exemplo n.º 4
0
 public PublishCommandItem(DotNetProject project, ProjectPublishProfile profile)
 {
     IsReentrant |= profile != null;
     this.Project = project;
     this.Profile = profile;
 }