Team City – Continuous Integration and Automated Testing

 
If Team City returns "Failure" > "Build Errors"
error MSB4019: The imported project "C:\Microsoft.VisualBasic.targets" was not found.
Then Team City is not using Microsoft Framework 3.5
Then go to Project Settings > Runner >
If using Visual Studio 2008 for a project .proj file then use
MSBuild
Build Version 3.5
Tools Version 3.5
 

 
Sln2008 only for solution files
 

 
Move to Server
 
Download – install – choose port
Access from another computer by using server address : port no.
 

 
Using Microsoft SQL Server
 
 
In order to use Windows Authentication need to copy dll file. In my case was
…Microsoft SQL Server JDBC Driver\sqljdbc_2.0\enu\auth\x86\sqljdbc_auth.dll
into Windows\System32 directory
 
 
file database.properties was
driverName=com.microsoft.sqlserver.jdbc.SQLServerDriver
connectionUrl=jdbc:sqlserver://localhost:<port>;database=TeamCity;
connectionProperties.integratedSecurity=true
 
 
 
 
 
 
 

Object binding to a BindingSource (and probably a DataGridView) – Add New Item

 

Private Sub DecisionBindingSource_AddingNew(ByVal sender As System.Object, ByVal e As System.ComponentModel.AddingNewEventArgs) Handles DecisionBindingSource.AddingNew

Try
Dim dNew As New Decision
dNew.DateInput = Today
dNew.IsNew = True
dNew.StatusID = Decision.StatusIDEnum.Current

'Lambda
Dim dList As IList(Of Decision) = CType(DecisionBindingSource.DataSource, IList(Of Decision))
dNew.ID = dList.Max(Function(d) d.ID) + 1
e.NewObject = dNew

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Lambda VB.Net Max

 

‘Lambda

Dim dList As IList(Of Decision) = CType(DecisionBindingSource.DataSource, IList(Of Decision))
dNew.ID = dList.Max(
Function(d) d.ID) + 1

Talking about How to: Bind Windows Forms Controls to DBNull Database Values

How to: Bind Objects to Windows Forms DataGridView Controls

 

Taken from MSDN Link Here but adjusted to make abstract

Private Sub SetupDGVComboBoxToEnum()
SetupDGVComboBoxColumnToEnumType(GetType(Decision.StatusIDEnum))
DGVColumnStatusID.DataPropertyName = "StatusID"
DGVColumnStatusID.Name = "Status"
End Sub

Private Sub SetupDGVComboBoxColumnToEnumType(ByVal enumType As Type)
DGVColumnStatusID.DataSource = [Enum].GetValues(enumType)
End Sub

Most Recently Used for objects on a form

 
Probably other ways of doing this. However this is my quickly devised method. Using a MRUToolStripDropDownButton.
Need to call MRUAdd after loading an object


Private mruList As IList(Of T)

Private Sub MRUAdd()
If mruList.Contains(Me.cPadMain) Then
mruList.Remove(Me.cPadMain)
End If

'Lambda
If mruList.Where(Function(m) m.ID = cPadMain.ID).Count = 0 Then
mruList.Insert(0, Me.cPadMain)
End If
MRUDisplay()

End Sub


Private Sub MRUDisplay()
MRUToolStripDropDownButton.DropDownItems.Clear()

'LINQ
Dim MRU As IEnumerable(Of PadMain) = From pm In mruList Order By pm.PadMaterial Descending
For Each pm As PadMain In MRU
Dim tsi As New ToolStripMenuItem
tsi.Tag = pm.ID
tsi.Text = pm.Pad + " in " + pm.Material.Material + " " + pm.ID.ToString
MRUToolStripDropDownButton.DropDownItems.Insert(0, tsi)
If MRUToolStripDropDownButton.DropDownItems.Count > 10 Then
Exit For
End If
Next

End Sub

LINQ samples

To use LINQ need

Imports System.Linq
May need reference to System.Core and System.Data
‘LINQ
Dim MRU As IEnumerable(Of PadMain) = From pm In mruList OrderBy pm.PadMaterial

LINQ to Entity Framework

Private
context As BC.SWT.EntityModel.SOPEntities

Dim EntityConnectionString = Configuration.ConfigurationManager.ConnectionStrings(“SOPEntities”).ConnectionString
context = New BC.SWT.EntityModel.SOPEntities(EntityConnectionString)

Dim
CustomerQuery AsObjectQuery(OfCustomer) = context.Customers
Dim results = From a In CustomerQuery Select a.CustomerID, a.Customer1 OrderBy Customer1

Lambda

Lamda Where


If cPadMain.PadHistoryList.Where(Function(h) h.IsNew = True).Count <> 0 Then
Dim cPadHistoryData As New PadHistoryData(Me.ConnectionStringSettings)
For Each ph As PadHistory In cPadMain.PadHistoryList.Where(Function(h) h.IsNew = True)
cPadHistoryData.Insert(ph)
Next
End If

Lamda Max

Dim dList As IList(Of Decision) = CType(DecisionBindingSource.DataSource, IList(Of Decision))
dNew.ID = dList.Max(Function(d) d.ID) + 1

Lamda check for repeats

Public Function IsSupplierPriorityOK() As Boolean
 
    'Lambda Check for repeats
    For Each cs1 As Costing.ComponentSupplier In Me.ComponentSupplierList.OrderBy(Function(h) h.Priority)
        Dim p1 As Integer = cs1.Priority
        If Me.ComponentSupplierList.Where(Function(h) h.Priority = p1).Count <> 1 Then
            Return False
        End If
    Next
    Return True
 
End Function

HTML Links

Dataset loses default connection My.MySettings when moved between projects

 
When moving dataset from one project to another, for example to create N-Tier then it may well lose the default connection. It is almost right but loses the My.MySettings bit.
 
Open DS.xsd file in notepad
Locate PropertyReference=”ApplicationSettings.ProjectName.MySettings.GlobalReference.Default.conStr…”
Change to PropertyReference=”ApplicationSettings.ProjectName.My.MySettings.GlobalReference.Default.conStrOperaDataset”