public void PrivateCannotLinkAcrossFragments() { XDocument doc = XDocument.Parse("<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'><Product Id='*' Language='1033' Manufacturer='WixTests' Name='PrivateCannotLinkAcrossFragments' Version='1.0.0' UpgradeCode='12345678-1234-1234-1234-1234567890AB'><DirectoryRef Id='PrivateDirectory'/></Product>" + "<Fragment><Directory Id='TARGETDIR' Name='SourceDir'><Directory Id='private PrivateDirectory' Name='private'/></Directory></Fragment></Wix>"); XDocument src = new Preprocessor().Process(doc.CreateReader(), new Dictionary <string, string>()); Compiler compiler = new Compiler(); Linker linker = new Linker(); Intermediate intermediate = compiler.Compile(src); WixException e = Assert.Throws <WixException>(() => linker.Link(intermediate.Sections, OutputType.Product)); Assert.Equal(WixErrors.UnresolvedReference(null, null).Id, e.Error.Id); }
public void InternalCannotLinkAcrossLibrary() { XDocument doc1 = XDocument.Parse("<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'><Fragment><Directory Id='TARGETDIR' Name='SourceDir' /></Fragment>" + "<Fragment><DirectoryRef Id='TARGETDIR'><Directory Id='internal InternalDirectory' Name='hidden'/></DirectoryRef></Fragment></Wix>"); XDocument doc2 = XDocument.Parse("<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'><Product Id='*' Language='1033' Manufacturer='WixTests' Name='ProtectedLinksAcrossFragments' Version='1.0.0' UpgradeCode='12345678-1234-1234-1234-1234567890AB'><DirectoryRef Id='TARGETDIR'/><DirectoryRef Id='InternalDirectory'/></Product></Wix>"); XDocument src1 = new Preprocessor().Process(doc1.CreateReader(), new Dictionary <string, string>()); XDocument src2 = new Preprocessor().Process(doc2.CreateReader(), new Dictionary <string, string>()); Compiler compiler = new Compiler(); Librarian librarian = new Librarian(); Linker linker = new Linker(); List <Section> sections = new List <Section>(); Intermediate intermediate = compiler.Compile(src1); Library library = librarian.Combine(intermediate.Sections); intermediate = compiler.Compile(src2); sections.AddRange(library.Sections); sections.AddRange(intermediate.Sections); WixException e = Assert.Throws <WixException>(() => linker.Link(sections, OutputType.Product)); Assert.Equal(WixErrors.UnresolvedReference(null, null).Id, e.Error.Id); }