本文整理汇总了C#中Project.BuildWxs方法的典型用法代码示例。如果您正苦于以下问题:C# Project.BuildWxs方法的具体用法?C# Project.BuildWxs怎么用?C# Project.BuildWxs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project.BuildWxs方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_CanInject_UserProfileNoise
public void Should_CanInject_UserProfileNoise()
{
var project = new Project("TestProject",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(@"Files\notepad.exe")),
new Dir(@"%CommonAppDataFolder%\Test Project",
new File(@"Files\TextFile.txt")),
new Dir(@"%PersonalFolder%\Test Project",
new File(@"Files\Baskets.bbd")));
project.WixSourceGenerated += xml =>
{
var dir = xml.FindAll("Directory")
.Where(x => x.HasAttribute("Name", "PersonalFolder"))
//.Where(x => x.HasAttribute("Name", v => v == "PersonalFolder"))
.SelectMany(x => x.FindAll("Component"))
.ForEach(comp => comp.InsertUserProfileRegValue()
.InsertUserProfileRemoveFolder());
};
string wxs = project.BuildWxs();
var doc = XDocument.Load(wxs);
}
示例2: Should_Handle_EmptyFeatures
public void Should_Handle_EmptyFeatures()
{
var binaries = new Feature("MyApp Binaries");
var docs = new Feature("MyApp Documentation");
var docs_01 = new Feature("Documentation 01");
var docs_02 = new Feature("Documentation 02");
var docs_03 = new Feature("Documentation 03");
docs.Children.Add(docs_01);
docs.Children.Add(docs_02);
docs.Children.Add(docs_03);
binaries.Children.Add(docs);
Project project = new Project("MyProduct",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(binaries, @"Files\Bin\MyApp.exe"),
new Dir(docs, @"Docs\Manual",
new File(docs_01, @"Files\Docs\Manual_01.txt"),
new File(docs_02, @"Files\Docs\Manual_02.txt"),
new File(docs_03, @"Files\Docs\Manual_03.txt")
)
)
);
project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
var wsxfile = project.BuildWxs();
var doc = XDocument.Load(wsxfile);
var product = doc.FindSingle("Product");
var rootFeature = doc.Select("Wix/Product/Feature");
Assert.NotNull(rootFeature);
var docsFeature = rootFeature.Elements()
.FirstOrDefault(e => e.HasLocalName("Feature")
&& e.HasAttribute("Title", value => value == "MyApp Documentation"));
Assert.NotNull(docsFeature);
var doc1Feature = docsFeature.Elements()
.FirstOrDefault(e => e.HasLocalName("Feature")
&& e.HasAttribute("Title", value => value == "Documentation 01"));
Assert.NotNull(doc1Feature);
var doc2Feature = docsFeature.Elements()
.FirstOrDefault(e => e.HasLocalName("Feature")
&& e.HasAttribute("Title", value => value == "Documentation 02"));
Assert.NotNull(doc2Feature);
var doc3Feature = docsFeature.Elements()
.FirstOrDefault(e => e.HasLocalName("Feature")
&& e.HasAttribute("Title", value => value == "Documentation 03"));
Assert.NotNull(doc3Feature);
}
示例3: Fix_Issue_67
public void Fix_Issue_67()
{
var project = new Project("MyProduct",
new Dir("%ProgramFiles%"));
project.LicenceFile = "license.rtf";
var file = project.BuildWxs();
}
示例4: Should_Preserve_ConstantsInAttrDefs
public void Should_Preserve_ConstantsInAttrDefs()
{
var project =
new Project("My Product",
new Dir(@"%ProgramFiles%\MyCompany",
new Dir("MyWebApp",
new File(@"MyWebApp\Default.aspx",
new IISVirtualDir
{
Name = "MyWebApp",
AppName = "Test",
WebSite = new WebSite("DefaultWebSite", "[IIS_SITE_ADDRESS]:[IIS_SITE_PORT]", "[IIS_SITE_NAME]"),
WebAppPool = new WebAppPool("MyWebApp", "Identity=applicationPoolIdentity")
}))));
string wxs = project.BuildWxs();
var address = XDocument.Load(wxs)
.FindSingle("WebAddress");
Assert.Equal("[IIS_SITE_ADDRESS]", address.ReadAttribute("Id"));
Assert.Equal("[IIS_SITE_PORT]", address.ReadAttribute("Port"));
}
示例5: Should_CanInject_UserProfileNoiseAutomatically
public void Should_CanInject_UserProfileNoiseAutomatically()
{
var project = new Project("TestProject",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(@"Files\notepad.exe")),
new Dir(@"%CommonAppDataFolder%\Test Project",
new File(@"Files\TextFile.txt")),
new Dir(@"%PersonalFolder%\Test Project",
new File(@"Files\Baskets.bbd")));
string wxs = project.BuildWxs();
var doc = XDocument.Load(wxs);
}
示例6: Should_Process_DirAttributes_2
public void Should_Process_DirAttributes_2()
{
var project =
new Project("My Product",
new Dir(@"%ProgramFiles%\MyCompany",
new Dir("MyWebApp", new File("Default.aspx"))));
project.AddEnvironmentVariable(new EnvironmentVariable("someVar", "Some value") { AttributesDefinition = "DiskId=2" });
string wxs = project.BuildWxs();
var doc = XDocument.Load(wxs);
}
示例7: Should_Process_DirAttributes
public void Should_Process_DirAttributes()
{
Dir dir1, dir2;
var project =
new Project("My Product",
dir1 = new Dir(@"%ProgramFiles%\MyCompany",
dir2 = new Dir("MyWebApp", new File("Default.aspx"))));
dir1.AttributesDefinition = "DiskId=1";
dir2.AttributesDefinition = "DiskId=2";
string wxs = project.BuildWxs();
var dirs = XDocument.Load(wxs)
.FindAll("Directory")
.Where(x => x.HasAttribute("DiskId"))
.ToArray();
Assert.Equal(2, dirs.Count());
Assert.True(dirs[0].HasAttribute("Name", "MyCompany"));
Assert.True(dirs[0].HasAttribute("DiskId", "1"));
Assert.True(dirs[1].HasAttribute("Name", "MyWebApp"));
Assert.True(dirs[1].HasAttribute("DiskId", "2"));
}
示例8: Should_Inject_RemoveFolder
public void Should_Inject_RemoveFolder()
{
var project = new Project("TestProject",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(@"Files\notepad.exe")),
new Dir(@"%CommonAppDataFolder%\Test Project",
new File(@"Files\TextFile.txt")),
new Dir(@"%PersonalFolder%\Test Project",
new File(@"Files\Baskets.bbd")));
project.WixSourceGenerated += Project_WixSourceGenerated;
string wxs = project.BuildWxs();
var doc = XDocument.Load(wxs);
}