MSTest on build-server

Keept getting errormessages like the following

C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): 
warning MSB3245: 
Could not resolve this reference. 
Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". 
Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

Turns out there is a simpler solution than installing Visual Studio on the build-server.
there is a nuget package that resolves this error

PM> Install-Package Microsoft.VisualStudio.QualityTools.UnitTestFramework.Updated

vb.NET inserting a file to a Binary field in the Database

In order to store Binary data in a table, all that is needed is to upload the bytes from the file, one way to do this is to use File.ReadAllBytes

Dim fileName As String = "C:\testfile.txt"
 
dbCommand = New SqlCommand("UPDATE FileTable SET BinaryFile=@BinaryFile WHERE FileId = @FileId", dbConnection)
dbCommand.Parameters.AddWithValue("@BinaryFile", File.ReadAllBytes(Filnamn))
dbCommand.Parameters.AddWithValue("@FileId", FileId)
 
dbCommand.ExecuteNonQuery()

.NET and matching element name with wildcard using XPath

This is similar to matching a name space with a wildcard.

'This is the node we are searching in
Dim someXmlNode As XmlNode = FetchXmlNode() 
Dim xPathExpr As String = String.Empty
 
'find all nodes with names that starts with nisse_
xPathExpr = ".//*[starts-with(name(), 'nisse_')]"
 
'loop through all elements that matches our XPath
For Each elementWithNisse As XmlNode In someXmlNode.SelectNodes(xPathExpr)
 
    AndHereAMiracleHappens(elementWithNisse)
 
Next

.NET and matching namespace with wildcard using XPath

.NET framework’s XslCompiledTransform only supports XPath and XSLT 1.0.

With XPath 1.0 ‘*’ is allowed to select all elements and nisse:* is allowed to select all elements in the namespace bound to the prefix ‘nisse’ but *:nisse to select ‘nisse’ elements in all
namespaces is not allowed in XPath 1.0, see http://www.w3.org/TR/xpath#node-tests.

And here is an example in vb.net where InnerText is read from the nameOfElementToFind in any name space

' This is the xmlnode the search is done with
Dim node As XmlNode = FetchSomeNode()
 
Dim innerTextFromNode As String = String.Empty
Dim xPathToSearchFor As String = String.Empty
 
'Will find all direct decendants nameOfElementToFind in any name space
xPathToSearchFor = "*[local-name() 'nameOfElementToFind']" 
 
'Will find all nameOfElementToFind in any name space and anywhere under this node
xPathToSearchFor = ".//*[local-name() 'nameOfElementToFind']" 
 
'Will find all nameOfElementToFind in any name space and anywhere in the document the node belongs to
xPathToSearchFor = "//*[local-name() 'nameOfElementToFind']"
 
If (node IsNot Nothing) Then
	innerTextFromNode = node.selectSingleNode(xPathToSearchIn).InnerText
End If