A
Ankit Raman
Guest
Hi All,
I have an issue while removing namespace prfix "asmv2". It is throwing null reference exception.
Please see below code snippet:
/// <summary>
/// Remove lines from the manifest that contain filenames that do not
/// exist in the addin bin folder
/// </summary>
/// <param name="manifest">Manifest file to edit</param>
private static void SanitizeManifestToMatchBin(string manifest, string addInBinFolder)
{
// load manifest
XDocument xDoc = XDocument.Load(manifest);
xDoc.Root.Attribute(XNamespace.Xmlns + "asmv2").Remove();
XNamespace ns = "urn:schemas-microsoft-com:asm.v2";
// remove any files from dependentAssembly/codebase that do not exist in the bin folder
xDoc.Descendants(ns + "dependentAssembly")
.Where(x => (string)x.Attribute("dependencyType") == "install" && File.Exists(addInBinFolder + "\\" + (string)x.Attribute("codebase").Value) == false)
.Select(x => x.Parent)
.Remove();
//xDoc.Descendants(ns + "file")
// .Where(x => File.Exists(addInBinFolder + "\\" + (string)x.Attribute("name").Value) == false)
// .Select(x => x)
// .Remove();
//xDoc.Descendants(ns + "file").Remove();
xDoc.Save(manifest);
}
At above code snippet,
xDoc.Root.Attribute(XNamespace.Xmlns + "asmv2").Remove(); //is throwing null reference exception.
Below is my xml manifest:
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
xmlns:dsig="XML-Signature Syntax and Processing"
xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
In above xml manifest, I found that "asmv2" is not available and I am trying to remove this entry.
Please help me to solve this problem.
Thank you.
Continue reading...
I have an issue while removing namespace prfix "asmv2". It is throwing null reference exception.
Please see below code snippet:
/// <summary>
/// Remove lines from the manifest that contain filenames that do not
/// exist in the addin bin folder
/// </summary>
/// <param name="manifest">Manifest file to edit</param>
private static void SanitizeManifestToMatchBin(string manifest, string addInBinFolder)
{
// load manifest
XDocument xDoc = XDocument.Load(manifest);
xDoc.Root.Attribute(XNamespace.Xmlns + "asmv2").Remove();
XNamespace ns = "urn:schemas-microsoft-com:asm.v2";
// remove any files from dependentAssembly/codebase that do not exist in the bin folder
xDoc.Descendants(ns + "dependentAssembly")
.Where(x => (string)x.Attribute("dependencyType") == "install" && File.Exists(addInBinFolder + "\\" + (string)x.Attribute("codebase").Value) == false)
.Select(x => x.Parent)
.Remove();
//xDoc.Descendants(ns + "file")
// .Where(x => File.Exists(addInBinFolder + "\\" + (string)x.Attribute("name").Value) == false)
// .Select(x => x)
// .Remove();
//xDoc.Descendants(ns + "file").Remove();
xDoc.Save(manifest);
}
At above code snippet,
xDoc.Root.Attribute(XNamespace.Xmlns + "asmv2").Remove(); //is throwing null reference exception.
Below is my xml manifest:
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
xmlns:dsig="XML-Signature Syntax and Processing"
xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
In above xml manifest, I found that "asmv2" is not available and I am trying to remove this entry.
Please help me to solve this problem.
Thank you.
Continue reading...