TFS 2010 Upload build from droplocation to FTP Activity C#

I had a recent request from a client asking to upload the build from the droplocation to an FTP drop location. I thought that this may prove useful for others:

Activity – C# .Net 4.0:

using System;
 using System.Activities;
 using System.IO;
 using System.Text.RegularExpressions;
 using Microsoft.TeamFoundation.Build.Client;
 using Microsoft.TeamFoundation.Build.Workflow.Activities;
 using Microsoft.TeamFoundation.VersionControl.Client;
 using System.Net;
namespace BuildTasks.Activities
 {
 [BuildActivity(HostEnvironmentOption.Agent)]
 public sealed class FTPUpload : CodeActivity
 {
 [RequiredArgument]
 public InArgument FTPUrl { get; set; }
[RequiredArgument]
 public InArgument Username { get; set; }
[RequiredArgument]
 public InArgument Password { get; set; }
[RequiredArgument]
 public InArgument DropLocation { get; set; }
// Obtain the runtime value of the input arguments
 string ftpURL = null;
 string username = null;
 string password = null;
 string dropLocation = null;
 string folder;
protected override void Execute(CodeActivityContext context)
 {
 ftpURL = context.GetValue(this.FTPUrl);
 username = context.GetValue(this.Username);
 password = context.GetValue(this.Password);
 dropLocation = context.GetValue(this.DropLocation);
Stream requestStream = null;
 FileStream fileStream = null;
 FtpWebResponse uploadResponse = null;
 try
 {
 if (Directory.Exists(dropLocation))
 {
 string[] folders = dropLocation.Split(new Char[] { '\\' });
 folder = folders[folders.Length - 1];
 }
 else
 {
 throw new DirectoryNotFoundException(String.Format("Drop Location Directory: \"{0}\", does not exist.", dropLocation));
 }
if (!(ftpURL.EndsWith("/"))) { ftpURL += "/"; }
FtpWebRequest uploadRequest;
 ICredentials credentials = new NetworkCredential(username, password);
 string[] fileNameParts;
 string fileName;
uploadRequest =
 (FtpWebRequest)WebRequest.Create(ftpURL + folder);
uploadRequest.Method = WebRequestMethods.Ftp.MakeDirectory;
 uploadRequest.Credentials = credentials;
uploadRequest.Proxy = null;
 uploadRequest.UsePassive = true;
uploadResponse =
 (FtpWebResponse)uploadRequest.GetResponse();
uploadResponse.Close();
foreach (string file in Directory.GetFiles(dropLocation))
 {
 fileNameParts = file.Split(new Char[] { '\\' });
 fileName = fileNameParts[fileNameParts.Length - 1];
uploadRequest =
 (FtpWebRequest)WebRequest.Create(ftpURL + folder + @"/" + fileName);
uploadRequest.Method = WebRequestMethods.Ftp.UploadFile;

uploadRequest.Credentials = credentials;

 uploadRequest.Proxy = null;
 uploadRequest.UsePassive = true;
requestStream = uploadRequest.GetRequestStream();
 fileStream = File.Open(file, FileMode.Open);
 byte[] buffer = new byte[1024];
 int bytesRead;
 while (true)
 {
 bytesRead = fileStream.Read(buffer, 0, buffer.Length);
 if (bytesRead == 0)
 break;
 requestStream.Write(buffer, 0, bytesRead);
 }
 //The request stream must be closed before getting
 //the response.
 requestStream.Close();
 uploadResponse =
 (FtpWebResponse)uploadRequest.GetResponse();
 }
 }
 catch (UriFormatException ex)
 {
}
 finally
 {
 if (uploadResponse != null)
 uploadResponse.Close();
 if (fileStream != null)
 fileStream.Close();
 if (requestStream != null)
 requestStream.Close();
 }
 }
 }
 }
Posted in Uncategorized | 11 Comments

Sort 2-Dimensional Jagged Array CSharp.

Hi,

I needed to sort a list of a 2-dimensional jagged array of files in MSBuild. The idea being is that I’d have SQL files from different folders. I’d like the files in both folders collected into a single list and then run alphabetically based upon filename not foldername+filename.

 using System; using System.Collections.Generic; using System.IO; using System.Text; using Microsoft.Build.Utilities; using Microsoft.Build.Framework; using System.Diagnostics; using System.Management; using System.Collections;
namespace MySortList
 {
 ///
public class SortList : Task
 {
 private bool _Success = true;
public virtual bool Success
 {
 get
 {
 return _Success;
 }
 set
 {
 _Success = value;
 }
 }
private string[] _SQLFileList;
[Required]
 public virtual string[] SQLFileList
 {
 get
 {
 return _SQLFileList;
 }
 set
 {
 _SQLFileList = value;
 }
 }
private string[] _SortedSQLFileList;
[Output]
 public virtual string[] SortedSQLFileList
 {
 get
 {
 return _SortedSQLFileList;
 }
 set
 {
 _SortedSQLFileList = value;
 }
 }
public override bool Execute()
 {
 string[][] sqlScriptFiles = new string[_SQLFileList.Length][];
for (int x = 0; x < _SQLFileList.Length; x++)
 {
sqlScriptFiles[x] = new string[2];
 //split the filePath to get the filename
 string[] splitFilePath = _SQLFileList[x].Split(new char[] { '\\' });
sqlScriptFiles[x][0] = _SQLFileList[x];
 //get last item in the array
 sqlScriptFiles[x][1] = splitFilePath[splitFilePath.Length - 1];
 }
//sort the script files based upon the second column - note zero based array, hence 1.
 Sort(sqlScriptFiles, 1);
List sortedSqlFiles = new List();
 foreach (string[] sqlFile in sqlScriptFiles)
 {
 sortedSqlFiles.Add(sqlFile[0].ToString());
 }
_SortedSQLFileList = sortedSqlFiles.ToArray();
return _Success;
 }
private static void Sort(T[][] data, int col)
 {
 Comparer comparer = Comparer.Default;
 Array.Sort(data, (x, y) => comparer.Compare(x[col], y[col]));
 }
}
}
Posted in Uncategorized | Leave a comment

MSBuild Kill Application Pool Process c#

Needed to kill an application pool process using an MSBuild task and C# cos the process was locking a file.


using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
using System.Diagnostics;
using System.Management;

namespace MyProject.Deployment.Tasks
{
public class AppPoolKillProcess : Task
{
const string logMessage = "Process Kill: {0}, for Application Pool: {1}";
const string query = "select * from Win32_Process where Name = 'w3wp.exe'";
const string logAppPoolNotFound = "Application Pool named '{0}' not found.";

[Required]
public string ApplicationPool { get; set; }

[Required]
public string ComputerName { get; set; }

private ManagementObjectSearcher objSearcher = new ManagementObjectSearcher(query);

public override bool Execute()
{

bool appPoolFound = false;
ConnectionOptions connOptions = new ConnectionOptions();
connOptions.Impersonation = ImpersonationLevel.Impersonate;
connOptions.EnablePrivileges = true;
ManagementScope manScope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", this.ComputerName), connOptions);
manScope.Connect();

SelectQuery objQuery = new SelectQuery(query);
ManagementObjectSearcher searcher = new ManagementObjectSearcher(manScope, objQuery);
ManagementObjectCollection searcherObjCollection = searcher.Get();

foreach (ManagementObject searchObj in searcherObjCollection)
{
//The Commandline property contains the application pool name.
if (searchObj["CommandLine"].ToString().Contains(this.ApplicationPool))
{

appPoolFound = true;
Log.LogMessage(MessageImportance.High, String.Format(logMessage, searchObj["ProcessId"].ToString(), searchObj["CommandLine"].ToString()));
object[] obj = new object[] { 0 };

searchObj.InvokeMethod("Terminate", obj);
}

}
//If not application pool found, then send a message to diagnostic.
if (!appPoolFound) Log.LogMessage(MessageImportance.High, string.Format(logAppPoolNotFound, this.ApplicationPool));

return true;

}
}
}

 

Posted in Uncategorized | Leave a comment

TFS 2010 Queue New Build Workflow Activity

Hi,

This has helped me a couple of times, so thought I’d post it. It’s a C# workflow activity that you can incorporate into your TFS 2010 build workflow to queue one build definition from another, i.e. when you’re queueing buddy builds. I’ve used this when I have a single build definition that does a get and compile, and with a second build definition that simply packages the solution ready for deployment.

FYI: The package build definition is very generic, and not tied to a single piece of work, hence splitting it apart from the initial Continuous Integration build definition.

The assumption is that target build definition is in the same TeamProject and TeamCollection as the primary build definition.

using System;
using System.Activities;
using System.Diagnostics;
using System.IO;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Build.Client;

namespace BuildTasks.Activities
{
// Queue a new build from the same Team Project.
// Change this class if you wish to use a different team project.
[BuildActivity(HostEnvironmentOption.Agent)]
public sealed class QueueNewBuild : CodeActivity
{
// The Team Project that the build definition belongs to.
[RequiredArgument]
public InArgument<IBuildDetail> BuildDetail { get; set; }

// The build definition to queue
[RequiredArgument]
public InArgument<String> BuildDefinition { get; set; }

protected override void Execute(CodeActivityContext context)
{

// Obtain the runtime value of the input arguments
string buildDefinition = context.GetValue(this.BuildDefinition);
IBuildDetail buildDetail = context.GetValue(this.BuildDetail);

var workspace = buildDetail.BuildDefinition.Workspace;

// Obtain the Team Project for the current build definition.
string tfsProject = buildDetail.BuildDefinition.TeamProject;

string configurationServerUri = buildDetail.BuildServer.TeamProjectCollection.Uri.ToString();

TfsTeamProjectCollection server = new TfsTeamProjectCollection(new Uri(configurationServerUri));
server.EnsureAuthenticated();
IBuildServer buildServer = (IBuildServer)server.GetService(typeof(IBuildServer));
IBuildDefinition buildDef = buildServer.GetBuildDefinition(tfsProject, buildDefinition);
buildServer.QueueBuild(buildDef);

}

}
}

Posted in Team Foundation Server 2010 | 2 Comments

Event log write permissions

Scenario: Writing to the event log on a Windows Server 2008 through my c# code. However I’m getting access denied errors when attempting to write events…

It’s an asp.net application written in C#. The application pool user is not the Network Service.

Plan:

Create an event source. This event source is what my application will write errors to. It means I can filter errors in the event log that are caused by my application alone.

Change the permissions allowing the domain user (who is not the Network Service) to write to the event log.

Create an Event Source

There lots of tools that can create an event source, the following is come vbscript that creates one…

Const EVENT_TYPE_SUCCESS = 0
Const EVENT_TYPE_ERROR   = 1
Const EVENT_TYPE_WARNING = 2
Const EVENT_TYPE_INFORMATION = 4
Const EVENT_TYPE_AUDITSUCCESS = 8
Const EVENT_TYPE_AUDITFAILURE = 16

Function MakeEvent()
    Dim objEvent

    Set objEvent = ScriptContext.CreateEvent()

    objEvent.EventSource = "MyApplication"
    objEvent.EventNumber = 4444
    objEvent.EventType = EVENT_TYPE_WARNING
    objEvent.LoggingDomain = "DOMAIN1"
    objEvent.SourceDomain = "DOMAIN1"

    Set MakeEvent = objEvent
End Function

Here the C# equivalent

using System;
using System.Diagnostics;

class MainClass
{
public static void Main ()
{
if (!EventLog.SourceExists(“MyApplication”))
{
EventLog.CreateEventSource(“MyApplication”, “Application”);
}
}

}

Access to Write to Event log

Open Cmd prompt as admin.

Type: C:\>wevtutil gl application > C:\temp\out.txt

This outputs the security credentials for the application event log to the given text file.

Open the generated C:\temp\out.txt file in Notepad

It looks a little bit like this:

name: application
enabled: true
type: Admin
owningPublisher:
isolation: Application
channelAccess: O:BAG:SYD:(A;;0xf0007;;;SY)(A;;0x7;;;BA)(A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)(A;;0x3;;;S-1-5-33)(A;;0x1;;;S-1-5-32-573)
logging:
logFileName: %SystemRoot%\System32\Winevt\Logs\application.evtx
retention: false
autoBackup: false
maxSize: 20971520
publishing:

The line you’re interested in is the “channelAccess”. (The wonderful Windows SDDL – Security Descriptor Definition Language).

You need to add (append) the following to the end of the line: (A;;0x3;;;AU)

–          This gives write/read access (the “0x3” bit ) to Authenticated Users (AU).

You then need to apply the updated setting…

C:\>wevtutil sl Application /ca:O:BAG:SYD:(A;;0xf0007;;;SY)(A;;0x7;;;BA)(A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)(A;;0x3;;;S-1-5-33)(A;;0x1;;;S-1-5-32-573)(A;;0x3;;;AU)

Done.

You can check the change by:
C:\>wevtutil gl application > C:\temp\updatedout.txt

And you’ll see the change in the channelAccess line.

The more eagle eyed amongst you (and you’d need to be eagle eyed to spot this) will notice that the registry location:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application now has an additional key CustomSD with the updated channelAccess key. This key only appears if the default configuration is changed, i.e. as I have done by granting Authenticated Users write access.

Important Info: Only applies cos the application user is not the NetworkService, but a domain user. The NetworkService user is already part of the approved list, so you won’t need to apply these steps.

Further Reading:
If you would like to prevent authenticated users from writing to the event log, and would prefer to lock down security further, you can follow the process above, but rather than giving access to all authenticated users, you can grant access to specific users by adding their SID (security ID) to the channel access list instead. VBScript to find SID for a user.

Ta

Padda

Posted in Windows Administration | 7 Comments

TFS 2010 Move from SQL Server Enterprise Evaluation 2008 to SQL Server Standard 2008

Scenario: TFS 2010 has been installed onto a SQL Server 2008 Enterprise Evaluation in the production environment (not by me!). Additionally, we’re using Sql Server Reporting Services and SQL Server Analysis Services along with the excellent Agile ScrumforTeamSystem template from EMC Consulting (formerly Conchango). Note: No Sharepoint. I’ve been tasked with migrating everything from SQL Server 2008 Enterprise Evaluation to SQL Server 2008 Standard.

Plan: Migrate everything to a new server, one that will act as backup, and then upgrade the existing SQL Server 2008 Enterprise Eval to SQL Server 2008 Standard. Note: we didn’t have the budget to pay for a SQL Server 2008 Enterprise license.

Risk Overview: SQL Server Enterprise Evaluation, as its name suggests, is an evaluation version of the software. It will expire after 180 days. Once this evaluation period has elapsed, access to the databases will be denied. You’ll need to migrate the data (*.mdf) and the log files (*.ldf) to a new data server and attach them.

Important Disclaimer: The following steps were followed and worked for me in my controlled environment. Everything was backed up, appropriate VM’s snapshotted etc. You follow these steps at your own risk!

High-level Migration Plan:

  1. Detach databases from source TFS.
  2. Backup databases from source SQL Server 2008 Ent Eval.
  3. Reattach databases to source TFS.
  4. Restore appropriate databases to destination SQL Server 2008 Ent Eval (yes, Ent Eval in backup server).
  5. Install the Scrum Template (ScrumForTeamSystem).
  6. Reconfigure Reporting Services on destination server.
  7. Reconfigure Analysis Services on destination server.
  8. Begin TFS Installation in destination server.
  9. Point TFS to the Reporting Services on destination server.
  10. Attach TFS projectCollections in TFS Admin Console.
  11. Ensure that TFS projectCollections are marked as Scrum in ScrumForTeamSystem.
  12. Source TFS – Remove SQL Server Enterprise features from TFS databases.
  13. Upgrade (yes, it’s called upgrade) SQL Server 2008 Enterprise Evaluation to SQL Server 2008 Standard.

Details:
Source Server

  1. Open Team Foundation Server Administration Console.
  2. Select Team Project Collections (from left hand menu)
  3. Select a Team Project Collection.
  4. At the bottom right of screen, select “Detach Collection.” (The Detach Team Project Collection) screen will open.
  5. Optional – enter a message.
  6. Click “Verify.” There will be a warning. The warning detail will show (I’m pararphrasing) that SQL Server migration may cause a problem.
  7. Click “Detach.”
  8. Repeat the above for each Team Project.
  9. Team Foundation Server 2010 Admin Console
  10. Open SQL Server Management Studio (Start > All Progs > Microsoft SQL Server 2008 > SQL Server Management Studio).
  11. Backup the following databases. (How to Backup)
    ReportServer
    ReportServerTempDB
    TFS_DefaultCollection (assuming your TFS Project Collection is DefaultCollection)
    TFS_Warehouse
    TFS_Analysis (you’ll need to open an Analysis Services Connection in SQL Server Mgmt Studio to get to this). Unlike databases, the analysis services  database will backup to one of it’s preconfigured storage locations, e.g. C:\Program Files\Microsoft SQL Server\MSAS10.MSSQLSERVER\OLAP\Backup.
  12. Open the Team Foundation Server Administration Console.
  13. Attach the Team Project collections that you detached earlier in step 8. As this is production, I need minimal impact, so I’m setting it back to it’s original state.
  14. Open SQL Server Reporting Services (Start > All Progs > Microsoft SQL Server 2008 > Configuration Tools > Reporting Services Configuration Manager).
  15. Backup the Reporting Services Encryption Key (How to Backup).

Destination Server

Copy the databases from the above to the destination server and restore them. (How to Restore).

Restoring the TFS_Analysis database is a little different. (How to restore Analysis Services DB). In short, copy the TFS_Analysis.abf to (C:\Program Files\Microsoft SQL Server\MSAS10.MSSQLSERVER\OLAP\Backup\). Then open up a connection to the Analysis Services in SQL Mgmt Studio, and run
<Restore xmlns=”http://schemas.microsoft.com/analysisservices/2003/engine“><File>C:\Program Files\Microsoft SQL Server\MSAS10.MSSQLSERVER\OLAP\Backup\Tfs_Analysis.abf</File>
</Restore>

Install Team Explorer 2010.

Install the Scrum Template (ScrumForTeamSystem).

Configure SQL Server Reporting Services.
Start > All Progs > Microsoft SQL Server 2008 > Configuration Tools > Reporting Services Configuration Manager).
Enter the Reporting Services Web Services URL (if this is a clean install, just click Apply and go with defaults).
Database – Choose an existing report server database.

Select ReportServer.

Click Next enter the appropriate credentials and click Finish.

Restore the Reporting Services (RS) Encryption Key.
Go to the source server and copy the RS encryption key that you backed up in step Source – 15 above to the destination server.

In RS, restore the encryption key.

Restore Reporting Services Encryption Key

Restore Reporting Services Encryption Key

On the destination server, go to Http://localhost/Reports/

Reporting Services URL

Reporting Services URL on Destination Server

Click on Tfs2010OlapReportDS. The screen will change displaying, amongst other things, the source server connection string. Change this to the destination server.

Repeat the above for the Tfs2010ReportDS link.

Open SQL Server Mgmt Studio and connect to the local database server.
Add the Analysis Server User to SQL Server.
CREATE LOGIN [Domain\AnalysisServicesUser] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]
GO

Analysis Services
In SQL Server Mgmt Studio, open a connection SQL Server Analysis Services.

Expand the databases, and you should see the database Tfs_Analysis.

Expand the database, go to Data Sources > Tfs_AnalysisDataSource. Change the connection string so that it now points to the destination server.

TFS Installation on Destination Server

Start the TFS 2010 Installation.

Configuration…

Select “Advanced Configuration”.

Database – assuming it’s correct, leave it as it is.

Enter the TFS service account details.

Untick Reporting Services configuration.

Untick Sharepoint Configuration.

Untick Create a new Team Project Collection.

Click “Verify” and then “Configure.”

Once complete, the TFS Admin Console will open. Select “Reporting” from the left hand menu.
Tick Use Reporting.
Warehouse tab – Enter the db server (destination server) and then TFS_Warehouse as the database name.
Analysis Services tab – Enter the db server and then TFS_Analysis as the database. Enter the domain\ReportingServicesUser and password.
Reports tab – Enter the server, then tick populate URL’s. These should appear as http://destinationServer:80/ReportServer and http://destinationServer:80/Reports
Enter the account details domain\ReportingServicesUser and password. The default path should be /TfsReports

Click “OK.”

Click “Start Jobs.”

Select Team Project Collection and click “Attach” (on right of screen).

Enter the db name, select the Team Project Collection you wish to attach.

Click “Next”, “Verify” and then “Attach.”
There will be warnings about Report location already being used, ignore this warning.

Process Warehouse and Analysis Services (optional).
On the destination server, go tohttp://localhost:8080/tfs/TeamFoundation/Administration/v3.0/WarehouseControlService.asmx?op=ProcessAnalysisDatabase

Enter Full into the textbox, then click Invoke.

Complete.

You should now be able to connect you Team Foundation 2010 TFS Server to the destination server and its project collections…

Next – Upgrade the SQL Server 2008 Enterprise Eval to SQL Server 2008 Standard.

Posted in Team Foundation Server 2010 | Tagged , , | 1 Comment

TFS 2010 Move from SQL Server Enterprise Evaluation 2008 to SQL Server Standard 2008 – Part 2

As you should have seen from part 1, the migration of TFS, if you’re using Reporting Services and Analysis Services is a little fiddly but possible.

This second part explains the steps taken to upgrade SQL Server 2008 Enterprise Evaluation to SQL Server 2008 Standard for our TFS 2010 Installation.

I’m not going to go into the differences between SQL Server 2008 Enterprise and Standard, there are plenty of posts (incl this on StackOverflow) that can help you decide which version best suits you.

Determine SQL Version
Open SQL Server Management Studio and make a connection to the Source server database.

Create the following query:

select @@version

You will see a result similar to the following
Microsoft SQL Server 2008 (RTM) – 10.0.1600.22 (X64)   Jul  9 2008 14:17:44   Copyright (c) 1988-2008 Microsoft Corporation  Enterprise Evaluation Edition (64-bit) on Windows NT 6.0 <X64> (Build 6002: Service Pack 2) (VM)

When TFS is installed on a server with SQL Server Enteprise Edition, is takes advantage of some of the Enterprise features, well one in particular, table compression. SQL Server Standard does not allow table compression, so moving (backup then restore) a database from Enterprise Edition to Standard will result in a big No-No. (I didn’t capture a screen shot of the error, but unlike many other error messages I’ve encountered over the years, it’s pretty clear what the problem is).

So, to find out which features are not compatible with SQL Standard, enter the following into a query window in SQL Server Management.
SELECT * FROM sys.dm_db_persisted_sku_features;
GO

The TFS databases that are deployed into SQL Enterpise use the table compression feature.

The following script displays the indexes and tables that use compression and generates a script that removes the compression.

SELECT DISTINCT ‘ALTER TABLE [‘ + SCHEMA_NAME(schema_id) + ‘].[‘ + NAME + ‘] REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = NONE);’
FROM sys.partitions p
join sys.objects o
on p.object_id = o.object_id
WHERE o.TYPE = ‘u’
and data_compression_desc != ‘NONE’
UNION
SELECT ‘ALTER INDEX ALL ON [‘ + SCHEMA_NAME(schema_id) + ‘].[‘ + NAME + ‘] REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = NONE);’
FROM sys.partitions p
join sys.objects o
on p.object_id = o.object_id
WHERE o.TYPE = ‘u’
and data_compression_desc != ‘NONE’

Remove Compression

Alter indexes and tables removing compression

The script output lists of sql statements that can be run to remove compression indexes and tables.

Copy them into a new Query windows, review them and then execute them.

This script needs running on the following TFS 2010 databases:
TFS_Configuration
TFS_Warehouse
TFS_DefaultCollection (assuming DefaultCollection is the name of your TFS project collection).

Upgrade SQL Server 2008 from Enterprise Evaluation to Standard

Run Setup.exe on your SQL Standard.

From the left hand menu, select “Maintenance”.

Select “Edition Upgrade”
Support Rules will identify any potential problems.

Click “Next” then enter your SQL Server 2008 Standard license key.

Upgrade the server instance, the default it MSSQLSERVER.
Edition Upgrade Rules will identify any potential problems.

Click “Next”.

Click “Upgrade”.

Upgrade takes approximately 1 minute.

Ensure that all SQL Services have restarted correctly
(Start > Run > services.msc)

Validate SQL Upgrade

Open SQL Server Management Studio.

Connect to the TFS 2010 database engine.

Open a query window

Type Select @@version

Microsoft SQL Server 2008 (SP1) – 10.0.2531.0 (X64)   Mar 29 2009 10:11:52   Copyright (c) 1988-2008 Microsoft Corporation  Standard Edition (64-bit) on Windows NT 6.0 <X64> (Build 6002: Service Pack 2) (VM)

You can now connect to your TFS instance which now has a SQL Server 2008 Standard instance behind it.

Hope this helps.

Padda

SELECT DISTINCT ‘ALTER TABLE [‘ + SCHEMA_NAME(schema_id) + ‘].[‘ + NAME + ‘] REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = NONE);’

FROM sys.partitions p

join sys.objects o

on p.object_id = o.object_id

WHERE o.TYPE = ‘u’

and data_compression_desc != ‘NONE’

UNION

SELECT ‘ALTER INDEX ALL ON [‘ + SCHEMA_NAME(schema_id) + ‘].[‘ + NAME + ‘] REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = NONE);’

FROM sys.partitions p

join sys.objects o

on p.object_id = o.object_id

WHERE o.TYPE = ‘u’

and data_compression_desc != ‘NONE’

Posted in Team Foundation Server 2010 | 1 Comment