I happen to create a windows service and its installer in VS 2005 using .Net. The service is pretty simple to implement and the installer as well. The thing that matters is that if we just add the service to the installer and installs it, the service will be installed on the machine but it would not be registered with SCM. In order to auto-register it with SCM what we need is to include two custom actions for Install and UnInstall.
The above is depicted in the following figures:
Installation custom action
Go to custom action, add a custom action for Install and select service primary output with the argument “/install” as shown in the figure below:

UnInstallation custom action
Go to custom action, add a custom action for UnInstall and select service primary output with the argument “/uninstall” as shown in the figure below:

Now when you will un-install, the service will be un-registered as well. A word of caution is that “before un-installing, stop your service. Otherwise it remains in your service manager and vanished once you restart or log-off from your machine”.

admin .Net service, Windows, windows service, windows service installer, windows service setup
Data bulk insertion is a requirement often faced by developers. Using dot net 2 and sql server 2005, Microsoft has provided a nice feature for bulk insertion using SqlBulkCopy class. It is really fast and indeed no comparison of performing instead in transaction or row by row. Coupling SqlBulkCopy with Transaction is very nice. Here how it works:
using (SqlConnection lConnection = new SqlConnection(“connection_string goes here”))
{
connection.Open();
SqlTransaction lTransaction =lConnection.BeginTransaction();
try
{
// BulkUpload actually starts here
using (SqlBulkCopy lCopy = new SqlBulkCopy(lConnection,
SqlBulkCopyOptions.Default, lTransaction))
{
lCopy.DestinationTableName = targetTable; // the table to which data is to be written
lCopy.ColumnMappings.Add(New SqlBulkCopyColumnMapping(SourceColumnName, DestinationColumnName));
lCopy.BatchSize= BATCH_SIZE; // records to be written in one batch
lCopy.NotifyAfter = 200; // in number of records
lCopy.WriteToServer(SourceTable);
lTransaction.commit();
catch
{
lTransaction.Rollback();
throw;
}
The above code writes a source data table to destination database table on the basis of connection string and table name. We can set the batch sieze, we may also write an event so that after each batch we are notified of the success. Its easy and certainly very fast.
admin .Net .Net, bulk copy, bulk insert, sql server 2005, sqlbulkcopy
Microsoft’s new version of Visual Studio i.e., 2010 is coming up with new wave of enhancements and features. Its major focus will be to ease developers, designers and architects by including advanced modeling features built in Studio 2010. Along with the studio, enhanced Visual Studio Team System will also be accompanied.
Having said that let’s look at what these feature are:
Modeling Facilities
Microsoft has decided to go extra miles by providing the facility of modeling to developers as well as business users. UML is also supported. These graphical facilities will ease users and developers to use right tools at the right time.
VSTS improvements
In order to improve the productivity and efficiency, new VSTS include features to remove non-reproducible bugs, and quick deployment for highest degree of completenes. It will also provide progress trakcing and ensure all code paths are properly tested.
Life cycle management
Major focus is on managing life cycle effectively so that less time is being consumed on managing life cycle and the collaboration is easy to maintain. Teams can track work items easily and hierarchical work item relationships are supported as well. Using TFS one can track changes across branches.
Above features are just a glimpse of what will be included in VSTS 2010. There is no shipping date as such available but we can hope to get a stable version before the time as its name implies
admin Visual Studio Collaboration, integration, team server, TFS, VSTS 2010
Recent Discussions