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); } } }
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); }
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)); }
public PublishCommandItem(DotNetProject project, ProjectPublishProfile profile) { IsReentrant |= profile != null; this.Project = project; this.Profile = profile; }