本文整理汇总了C#中PackageBuilder类的典型用法代码示例。如果您正苦于以下问题:C# PackageBuilder类的具体用法?C# PackageBuilder怎么用?C# PackageBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PackageBuilder类属于命名空间,在下文中一共展示了PackageBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreatePackageAddsVersionStampIfFrameworkAssembliesAreUsed
public void CreatePackageAddsVersionStampIfFrameworkAssembliesAreUsed()
{
// Arrange
PackageBuilder builder = new PackageBuilder() {
Id = "A",
Version = new Version("1.0"),
Description = "Descriptions",
};
builder.Authors.Add("David");
builder.FrameworkReferences.Add(new FrameworkAssemblyReference("System.Web"));
var ms = new MemoryStream();
// Act
Manifest.Create(builder).Save(ms);
ms.Seek(0, SeekOrigin.Begin);
// Assert
Assert.AreEqual(@"<?xml version=""1.0"" encoding=""utf-8""?>
<package xmlns=""http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"">
<metadata schemaVersion=""2"">
<id>A</id>
<version>1.0</version>
<authors>David</authors>
<owners>David</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Descriptions</description>
<frameworkAssemblies>
<frameworkAssembly assemblyName=""System.Web"" targetFramework="""" />
</frameworkAssemblies>
</metadata>
</package>", ms.ReadToEnd());
}
开发者ID:jacksonh,项目名称:nuget,代码行数:32,代码来源:PackageBuilderTest.cs
示例2: Fill
public void Fill (PackageBuilder builder, SolutionItem selection)
{
store.Clear ();
this.builder = builder;
if (selection is SolutionFolder) {
foreach (SolutionItem e in ((SolutionFolder)selection).GetAllItems ()) {
if (builder.CanBuild (e))
selectedEntries [e] = e;
}
}
else if (selection != null) {
selectedEntries [selection] = selection;
}
if (selection != null)
solution = selection.ParentSolution;
else {
solution = IdeApp.ProjectOperations.CurrentSelectedSolution;
if (solution == null) {
ReadOnlyCollection<Solution> items = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem.GetAllSolutions ();
if (items.Count > 0)
solution = items [0];
else
return;
}
}
AddEntry (TreeIter.Zero, solution.RootFolder);
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:29,代码来源:EntrySelectionTree.cs
示例3: Burn_CancelExecuteWhileCaching
public void Burn_CancelExecuteWhileCaching()
{
// Build the packages.
string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output;
string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output;
// Create the named bind paths to the packages.
Dictionary<string, string> bindPaths = new Dictionary<string, string>();
bindPaths.Add("packageA", packageA);
bindPaths.Add("packageB", packageB);
// Build the bundle.
string bundleA = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
// Slow the caching of package B to ensure that package A starts installing and cancels.
this.SetPackageCancelExecuteAtProgress("PackageA", 50);
this.SetPackageSlowCache("PackageB", 1000);
// Install the bundle and hopefully it fails.
BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(expectedExitCode: ErrorCodes.ERROR_INSTALL_USEREXIT);
Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA));
Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB));
this.CleanTestArtifacts = true;
}
开发者ID:Jeremiahf,项目名称:wix3,代码行数:25,代码来源:Burn.FailureTests.cs
示例4: CtorWithStream
public void CtorWithStream()
{
// Arrange
var builder = new PackageBuilder();
builder.Id = "Package";
builder.Version = new SemanticVersion("1.0");
builder.Authors.Add("David");
builder.Description = "This is a test package";
builder.ReleaseNotes = "This is a release note.";
builder.Copyright = "Copyright";
builder.Files.AddRange(PackageUtility.CreateFiles(new[] { @"lib\40\A.dll", @"content\foo" }));
var ms = new MemoryStream();
builder.Save(ms);
ms.Seek(0, SeekOrigin.Begin);
// Act
var package = new ZipPackage(ms);
// Assert
Assert.Equal("Package", package.Id);
Assert.Equal(new SemanticVersion("1.0"), package.Version);
Assert.Equal("David", package.Authors.First());
Assert.Equal("Copyright", package.Copyright);
var files = package.GetFiles().ToList();
Assert.Equal(2, files.Count);
Assert.Equal(@"content\foo", files[0].Path);
Assert.Equal(@"lib\40\A.dll", files[1].Path);
var assemblyReferences = package.AssemblyReferences.ToList();
Assert.Equal(1, assemblyReferences.Count);
Assert.Equal("A.dll", assemblyReferences[0].Name);
Assert.Equal(new FrameworkName(".NETFramework", new Version("4.0")), assemblyReferences[0].TargetFramework);
Assert.Equal("This is a release note.", package.ReleaseNotes);
}
开发者ID:xero-github,项目名称:Nuget,代码行数:34,代码来源:ZipPackageTest.cs
示例5: Burn_InstallUninstallBundleWithEmbeddedBundle
public void Burn_InstallUninstallBundleWithEmbeddedBundle()
{
// Build the packages.
string packageA1 = new PackageBuilder(this, "A").Build().Output;
string packageB1 = new PackageBuilder(this, "B").Build().Output;
// Create the named bind paths to the packages.
Dictionary<string, string> bindPaths = new Dictionary<string, string>();
bindPaths.Add("packageA", packageA1);
bindPaths.Add("packageB", packageB1);
// Build the embedded bundle.
string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
// Build the parent bundle
bindPaths.Add("bundleB", bundleB);
string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
// Install the bundles.
BundleInstaller installerA = new BundleInstaller(this, bundleA).Install();
// Test package is installed.
Assert.True(MsiVerifier.IsPackageInstalled(packageA1));
Assert.True(MsiVerifier.IsPackageInstalled(packageB1));
// Attempt to uninstall bundleA.
installerA.Uninstall();
// Test package is uninstalled.
Assert.False(MsiVerifier.IsPackageInstalled(packageA1));
Assert.False(MsiVerifier.IsPackageInstalled(packageB1));
this.Complete();
}
开发者ID:bleissem,项目名称:wix3,代码行数:34,代码来源:Burn.OriginalSourceTests.cs
示例6: Burn_RedirectPackageCache
public void Burn_RedirectPackageCache()
{
const string PolicyName = "PackageCache";
// Build the packages.
string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output;
string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output;
// Create the named bind paths to the packages.
Dictionary<string, string> bindPaths = new Dictionary<string, string>();
bindPaths.Add("packageA", packageA);
bindPaths.Add("packageB", packageB);
// Build the bundles.
string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
RegistryKey policy = Registry.LocalMachine.CreateSubKey(@"Software\Policies\WiX\Burn");
string currentPackageCache = null;
try
{
currentPackageCache = policy.GetValue(PolicyName) as string;
// Install the first bundle using the default package cache.
policy.DeleteValue(PolicyName);
BundleInstaller installerA = new BundleInstaller(this, bundleA).Install();
Assert.True(MsiVerifier.IsPackageInstalled(packageA));
// Install the second bundle which has a shared package using the redirected package cache.
string path = Path.Combine(Path.GetTempPath(), "Package Cache");
policy.SetValue(PolicyName, path);
BundleInstaller installerB = new BundleInstaller(this, bundleB).Install();
Assert.True(MsiVerifier.IsPackageInstalled(packageA));
Assert.True(MsiVerifier.IsPackageInstalled(packageB));
// The first bundle should leave package A behind.
installerA.Uninstall();
// Now make sure that the second bundle removes packages from either cache directory.
installerB.Uninstall();
this.Complete();
}
finally
{
if (!string.IsNullOrEmpty(currentPackageCache))
{
policy.SetValue(PolicyName, currentPackageCache);
}
else
{
policy.DeleteValue(PolicyName);
}
policy.Dispose();
}
}
开发者ID:zooba,项目名称:wix3,代码行数:60,代码来源:Burn.PolicyTests.cs
示例7: Burn_ComponentSearchResults
public void Burn_ComponentSearchResults()
{
// Build the packages.
string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output;
string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output;
Dictionary<string, string> bindPaths = new Dictionary<string, string>();
bindPaths.Add("packageA", packageA);
bindPaths.Add("packageB", packageB);
// Build the bundles.
string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
// Install the bundles.
BundleInstaller installerA = new BundleInstaller(this, bundleA).Install();
BundleInstaller installerB = new BundleInstaller(this, bundleB).Install();
// PackageB will be installed if all ComponentSearches worked.
Assert.True(MsiVerifier.IsPackageInstalled(packageA));
Assert.True(MsiVerifier.IsPackageInstalled(packageB));
// Uninstall the main bundle and add-on.
installerA.Uninstall();
this.Complete();
}
开发者ID:zooba,项目名称:wix3,代码行数:27,代码来源:Burn.SearchTests.cs
示例8: Burn_InstallUninstall
public void Burn_InstallUninstall()
{
string v2Version = "2.0.0.0";
// Build the packages.
string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output;
string packageC = new PackageBuilder(this, "C") { Extensions = Extensions }.Build().Output;
// Create the named bind paths to the packages.
Dictionary<string, string> bindPaths = new Dictionary<string, string>();
bindPaths.Add("packageA", packageA);
bindPaths.Add("packageC", packageC);
// Add the bindpath for the cab for C to enable to add it as a payload for BundleA
bindPaths.Add("packageCcab", Path.Combine(Path.GetDirectoryName(packageC), "cab1.cab"));
// Build the embedded bundle.
string bundleBv2 = new BundleBuilder(this, "BundleBv2") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", v2Version } } }.Build().Output;
// Build the parent bundle.
bindPaths.Add("bundleBv2", bundleBv2);
string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
// Install the parent bundle that will install the embedded bundle.
BundleInstaller installerA = new BundleInstaller(this, bundleA).Install();
Assert.True(MsiVerifier.IsPackageInstalled(packageA));
Assert.True(MsiVerifier.IsPackageInstalled(packageC));
// Attempt to uninstall bundleA, which will uninstall bundleB since it is a patch related bundle.
installerA.Uninstall();
Assert.False(MsiVerifier.IsPackageInstalled(packageA));
Assert.False(MsiVerifier.IsPackageInstalled(packageC));
this.Complete();
}
开发者ID:zooba,项目名称:wix3,代码行数:35,代码来源:Burn.EmbeddedTests.cs
示例9: Burn_PermanentInstallUninstall
public void Burn_PermanentInstallUninstall()
{
// Build the packages.
string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output;
string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output;
// Create the named bind paths to the packages.
Dictionary<string, string> bindPaths = new Dictionary<string, string>();
bindPaths.Add("packageA", packageA);
bindPaths.Add("packageB", packageB);
// Build the bundles.
string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
// Install Bundle A.
BundleInstaller installerA = new BundleInstaller(this, bundleA).Install();
Assert.True(MsiVerifier.IsPackageInstalled(packageA));
Assert.True(MsiVerifier.IsPackageInstalled(packageB));
// Uninstall bundleA.
installerA.Uninstall();
Assert.True(MsiVerifier.IsPackageInstalled(packageA));
Assert.False(MsiVerifier.IsPackageInstalled(packageB));
this.Complete();
}
开发者ID:zooba,项目名称:wix3,代码行数:28,代码来源:Burn.PermanentTests.cs
示例10: CreateTestPackage
/// <summary>
/// Creates a test package.
/// </summary>
/// <param name="packageId">The id of the created package.</param>
/// <param name="version">The version of the created package.</param>
/// <param name="path">The directory where the package is created.</param>
/// <returns>The full path of the created package file.</returns>
public static string CreateTestPackage(string packageId, string version, string path, Uri licenseUrl = null)
{
var packageBuilder = new PackageBuilder
{
Id = packageId,
Version = new SemanticVersion(version),
Description = "Test desc"
};
if (licenseUrl != null)
{
packageBuilder.LicenseUrl = licenseUrl;
}
var dependencies = new PackageDependency("Dummy");
packageBuilder.DependencySets.Add(new PackageDependencySet(null, new[] { dependencies }));
packageBuilder.Authors.Add("test author");
var packageFileName = string.Format("{0}.{1}.nupkg", packageId, version);
var packageFileFullPath = Path.Combine(path, packageFileName);
using (var fileStream = File.Create(packageFileFullPath))
{
packageBuilder.Save(fileStream);
}
return packageFileFullPath;
}
开发者ID:kumavis,项目名称:NuGet,代码行数:34,代码来源:Util.cs
示例11: OwnersFallsBackToAuthorsIfNoneSpecified
public void OwnersFallsBackToAuthorsIfNoneSpecified()
{
// Arrange
PackageBuilder builder = new PackageBuilder()
{
Id = "A",
Version = new SemanticVersion("1.0"),
Description = "Description"
};
builder.Authors.Add("JohnDoe");
var ms = new MemoryStream();
// Act
Manifest.Create(builder).Save(ms);
ms.Seek(0, SeekOrigin.Begin);
// Assert
Assert.Equal(@"<?xml version=""1.0""?>
<package xmlns=""http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"">
<metadata>
<id>A</id>
<version>1.0</version>
<authors>JohnDoe</authors>
<owners>JohnDoe</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description</description>
</metadata>
</package>", ms.ReadToEnd());
}
开发者ID:Newtopian,项目名称:nuget,代码行数:29,代码来源:PackageBuilderTest.cs
示例12: ReleaseNotesAttributeIsRecognized
public void ReleaseNotesAttributeIsRecognized()
{
// Arrange
PackageBuilder builder = new PackageBuilder()
{
Id = "A",
Version = new SemanticVersion("1.0"),
Description = "Description",
ReleaseNotes = "Release Notes"
};
builder.Authors.Add("David");
var ms = new MemoryStream();
// Act
Manifest.Create(builder).Save(ms);
ms.Seek(0, SeekOrigin.Begin);
// Assert
Assert.Equal(@"<?xml version=""1.0""?>
<package xmlns=""http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"">
<metadata>
<id>A</id>
<version>1.0</version>
<authors>David</authors>
<owners>David</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description</description>
<releaseNotes>Release Notes</releaseNotes>
</metadata>
</package>", ms.ReadToEnd());
}
开发者ID:anurse,项目名称:NuGet,代码行数:31,代码来源:PackageBuilderTest.cs
示例13: ServerPackageRepositoryReadsDerivedData
public void ServerPackageRepositoryReadsDerivedData()
{
// Arrange
var mockProjectSystem = new Mock<MockProjectSystem>() { CallBase = true };
var package = new PackageBuilder() { Id = "Test", Version = new System.Version("1.0"), Description = "Description" };
var mockFile = new Mock<IPackageFile>();
mockFile.Setup(m => m.Path).Returns("foo");
mockFile.Setup(m => m.GetStream()).Returns(new MemoryStream());
package.Files.Add(mockFile.Object);
package.Authors.Add("Test Author");
var memoryStream = new MemoryStream();
package.Save(memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
mockProjectSystem.Object.AddFile("foo.nupkg");
mockProjectSystem.Setup(c => c.OpenFile(It.IsAny<string>())).Returns(() => new MemoryStream(memoryStream.ToArray()));
var serverRepository = new ServerPackageRepository(new DefaultPackagePathResolver(mockProjectSystem.Object), mockProjectSystem.Object);
serverRepository.HashProvider = GetHashProvider();
// Act
var packages = serverRepository.GetPackagesWithDerivedData();
// Assert
byte[] data = memoryStream.ToArray();
Assert.AreEqual(data.Length, packages.Single().PackageSize);
CollectionAssert.AreEquivalent(data.Select(Invert).ToArray(), Convert.FromBase64String(packages.Single().PackageHash));
Assert.AreEqual(data.Length, packages.Single().PackageSize);
}
开发者ID:jacksonh,项目名称:nuget,代码行数:27,代码来源:ServerPackageRepositoryTest.cs
示例14: Fill
public void Fill (PackageBuilder builder, SolutionFolderItem selection)
{
store.Clear ();
this.builder = builder;
if (selection is SolutionFolder) {
foreach (SolutionFolderItem e in ((SolutionFolder)selection).GetAllItems ()) {
if (builder.CanBuild (e))
selectedEntries [e] = e;
}
}
else if (selection != null) {
selectedEntries [selection] = selection;
}
if (selection != null)
solution = selection.ParentSolution;
else {
solution = IdeApp.ProjectOperations.CurrentSelectedSolution;
if (solution == null) {
solution = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem.GetAllItems<Solution> ().FirstOrDefault();
if (solution == null)
return;
}
}
AddEntry (TreeIter.Zero, solution.RootFolder);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:27,代码来源:EntrySelectionTree.cs
示例15: Burn_PermanentInstallForceUninstall
public void Burn_PermanentInstallForceUninstall()
{
// Build the packages.
string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output;
string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output;
// Create the named bind paths to the packages.
Dictionary<string, string> bindPaths = new Dictionary<string, string>();
bindPaths.Add("packageA", packageA);
bindPaths.Add("packageB", packageB);
// Build the bundles.
string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
// Install Bundle A.
BundleInstaller installerA = new BundleInstaller(this, bundleA).Install();
Assert.True(MsiVerifier.IsPackageInstalled(packageA));
Assert.True(MsiVerifier.IsPackageInstalled(packageB));
// Force Uninstall Bundle A.
this.SetPackageRequestedState("PackageA", Microsoft.Tools.WindowsInstallerXml.Bootstrapper.RequestState.ForceAbsent);
this.SetPackageRequestedState("PackageB", Microsoft.Tools.WindowsInstallerXml.Bootstrapper.RequestState.ForceAbsent);
installerA.Uninstall();
Assert.False(MsiVerifier.IsPackageInstalled(packageA));
Assert.False(MsiVerifier.IsPackageInstalled(packageB));
this.Complete();
}
开发者ID:zooba,项目名称:wix3,代码行数:30,代码来源:Burn.PermanentTests.cs
示例16: CreateTestPackage
/// <summary>
/// Creates a test package.
/// </summary>
/// <param name="packageId">The id of the created package.</param>
/// <param name="version">The version of the created package.</param>
/// <param name="path">The directory where the package is created.</param>
/// <returns>The full path of the created package file.</returns>
public static string CreateTestPackage(string packageId, string version, string path, Uri licenseUrl = null)
{
var packageBuilder = new PackageBuilder
{
Id = packageId,
Version = new SemanticVersion(version),
Description = "Test desc"
};
if (licenseUrl != null)
{
packageBuilder.LicenseUrl = licenseUrl;
}
packageBuilder.Files.Add(CreatePackageFile(@"content\test1.txt"));
packageBuilder.Authors.Add("test author");
var packageFileName = string.Format("{0}.{1}.nupkg", packageId, version);
var packageFileFullPath = Path.Combine(path, packageFileName);
using (var fileStream = File.Create(packageFileFullPath))
{
packageBuilder.Save(fileStream);
}
return packageFileFullPath;
}
开发者ID:riteshparekh,项目名称:NuGet,代码行数:33,代码来源:Util.cs
示例17: GenerateArchiveDataFromPackage
private void GenerateArchiveDataFromPackage(PackageBuilder packageBuilder)
{
using (var archiveStream = new MemoryStream())
{
packageBuilder.GeneratePackageArchive(archiveStream);
_archiveData = archiveStream.ToArray();
}
}
开发者ID:0install,项目名称:0install-win,代码行数:8,代码来源:ZipExtractorTest.cs
示例18: DeployPackage
private string DeployPackage(string id, PackageBuilder builder)
{
string path = Path.Combine(_tempDir, id);
builder.WritePackageInto(path);
ManifestTest.CreateDotFile(path, ManifestFormat.FromPrefix(id), _handler);
FileUtils.EnableWriteProtection(path);
return path;
}
开发者ID:0install,项目名称:0install-win,代码行数:8,代码来源:DirectoryStoreTest.cs
示例19: GivenParentProductCategory_WhenPackageIsDefined_ThenValidationHasErrors
public void GivenParentProductCategory_WhenPackageIsDefined_ThenValidationHasErrors()
{
var package = new PackageBuilder(this.DatabaseSession).WithName("package").Build();
var parent = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("parent").WithPackage(package).Build();
var child = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("child").WithParent(parent).Build();
Assert.IsTrue(new Derivation(this.DatabaseSession).Derive().HasErrors);
}
开发者ID:Allors,项目名称:apps,代码行数:9,代码来源:ProductCategoryTests.cs
示例20: GetPackageA
private PackageBuilder GetPackageA()
{
if (null == this.packageA)
{
this.packageA = this.CreatePackage("A");
}
return this.packageA;
}
开发者ID:bleissem,项目名称:wix3,代码行数:9,代码来源:RestartTests.cs
注:本文中的PackageBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论