PowerShell Version
|
Release Date
|
Default Windows Versions
|
Available Windows Versions
|
PowerShell 1.0
|
November 2006
|
Windows Server 2008 (*)
|
|
PowerShell 2.0
|
October 2009
|
Windows 7
Windows Server 2008 R2 (**) |
|
PowerShell 3.0
|
September 2012
|
Windows 8
Windows Server 2012 |
|
PowerShell 4.0
|
October 2013
|
Windows 8.1
Windows Server 2012 R2 |
|
PowerShell 5.0
|
April 2014 (***)
|
Windows 10
|
Sunday, July 3, 2016
Windows and PowerShell versions
Although it's written all over the net i just felt i had to put it also, it makes life easier when using the TFS2015 builds and you know what is missing....
Saturday, April 23, 2016
vNext Build Git
The new TFS2015 Build system is very powerful and easy to use.
but there are still no tasks for git integration and we are forced to use batch / Power Shell scripts.
commit / push
when a git is cloned by the build it creates a detached head (temporary branch)
do this (case sensitive):
git commit "<files>" -m "comment"
git branch -a // show all branches optional
git rebase HEAD <branch name>
git push origin <branch name>
** make sure the build agent user has "Exempt from policy enforcement" set to allow otherwise the push will fail if branch policies exist.
Warning
I have noticed that using pull request with a build policy and the build performs updates to the repository causes the pull request to not function correctly as rebase also pushes the pull request.
branch polices
Although written, for all new users to Git, Visual studio will not let you create a Pull request
(available since VS2015.1) from the same branch locally to the same branch remotely.
the ideal way is to use git flow and create pull request from develop to master
but there are still no tasks for git integration and we are forced to use batch / Power Shell scripts.
commit / push
when a git is cloned by the build it creates a detached head (temporary branch)
do this (case sensitive):
git commit "<files>" -m "comment"
git branch -a // show all branches optional
git rebase HEAD <branch name>
git push origin <branch name>
** make sure the build agent user has "Exempt from policy enforcement" set to allow otherwise the push will fail if branch policies exist.
Warning
I have noticed that using pull request with a build policy and the build performs updates to the repository causes the pull request to not function correctly as rebase also pushes the pull request.
branch polices
Although written, for all new users to Git, Visual studio will not let you create a Pull request
(available since VS2015.1) from the same branch locally to the same branch remotely.
the ideal way is to use git flow and create pull request from develop to master
Wednesday, January 6, 2016
Running old XAML build templates on TFS 2015 build server
Recently i arrived to help a client in upgrading their TFS2012 to TFS2015 Update 1.
the upgrade passed successfully without any issues.
however when we tried to run the builds we often got an error the template could not be loaded.
So first thing i did was to verify all the custom build assemblies were upgraded and don't contain "microsoft.teamfoundation.dll" as this assembly is not included since TFS2013 (merged to microsoft.Teamfoundation.Client). sadly this did not help.
after long try and error (google was no help here :(), i found this to be a reference written in the XAML it self.
i opened the XAML in Notepad and found,
there is a section called "TextExpressions.ReferancesForImplementation" there i found
<AssemblyReference>Microsoft.TeamFoundation</AssemblyReference>
removing this line fixed the problem and the template was able to load
hope this will help you also...
the upgrade passed successfully without any issues.
however when we tried to run the builds we often got an error the template could not be loaded.
So first thing i did was to verify all the custom build assemblies were upgraded and don't contain "microsoft.teamfoundation.dll" as this assembly is not included since TFS2013 (merged to microsoft.Teamfoundation.Client). sadly this did not help.
after long try and error (google was no help here :(), i found this to be a reference written in the XAML it self.
i opened the XAML in Notepad and found,
there is a section called "TextExpressions.ReferancesForImplementation" there i found
<AssemblyReference>Microsoft.TeamFoundation</AssemblyReference>
removing this line fixed the problem and the template was able to load
hope this will help you also...
Tuesday, October 6, 2015
TFS2015 API
Microsoft has taken a twist in their API as it now can work in 2 modes:
also now you need to install Nuget packages to get the TFS API dlls.
taken from: https://www.visualstudio.com/en-us/integrate/get-started/client-libraries/dotnet
as seen in the above table you will need to install the "Microsoft.TeamFoundationServer.ExtendedClient" package to upgrade your old TFS apps.
this package also installs the other packages.
the down side of using these packages is that you get all the references that it contains and you need to remove unnecessary ones (there will be a lot of them).
example for using REST objects can be found at: https://www.visualstudio.com/en-us/integrate/get-started/client-libraries/samples
- Soap - same objects as before
- REST - new to TFS 2015, new objects which usually end with "HttpClient"
also now you need to install Nuget packages to get the TFS API dlls.
| Package | Description | Primary usage |
|---|---|---|
| Microsoft.TeamFoundationServer.ExtendedClient | Integrate with Microsoft Team Foundation Server (2012, 2013, 2015) and Visual Studio Online from desktop-based Windows applications. Work with and manage version control, work items, and build, and other resources from your client application. | Existing Windows apps leveraging an older version of the TFS Client OM. |
| Microsoft.TeamFoundationServer.Client | Integrate with Team Foundation Server 2015 and Visual Studio Online from desktop-based, ASP.NET, and other Windows applications. Provides access to version control, work item tracking, build, and more via public REST APIs. | Window desktop apps and services that need to integrate with TFS 2015 and later and Visual Studio Online. |
| Microsoft.VisualStudio.Services.Client | Integrate with Team Foundation Server 2015 and Visual Studio Online from desktop-based, ASP.NET, and other Windows applications. Provides access to shared platform services such as account, profile, identity, security, and more via public REST APIs. | Windows desktop apps and services that need to interact with "shared platform" services (account, profile, identity, security, etc). |
| Microsoft.VisualStudio.Services.InteractiveClient | Integrate with Team Foundation Server 2015 and Visual Studio Online from desktop-based Windows applications that require interactive sign-in by a user. | Windows desktop applications not utilizing basic authentication or OAuth for authentication. |
as seen in the above table you will need to install the "Microsoft.TeamFoundationServer.ExtendedClient" package to upgrade your old TFS apps.
this package also installs the other packages.
the down side of using these packages is that you get all the references that it contains and you need to remove unnecessary ones (there will be a lot of them).
example for using REST objects can be found at: https://www.visualstudio.com/en-us/integrate/get-started/client-libraries/samples
ImDisk Simple USB Drive
ImDisk is a dll which contains methods to emulate various storage devices (HDD, USB, CD).
unfortunately I haven't seen any seen any examples that i can use.
although there is a very detailed documents on the methods
http://www.ltr-data.se/library/ImDiskNet/html/b33f1e89-3d92-fc08-248d-14c5c2efd549.htm
so here is a simple example how to create a USB drive and disconnect it
// get device handle and free drive letter
uint deviceID = 0;
IntPtr statusControl = IntPtr.Zero;
string driveLetter = ImDiskAPI.FindFreeDriveLetter() + ":";
// create device
// 40mb = 4096*1024*10
ImDiskAPI.CreateDevice(4096 * 1024 * 10, 0, 0, 0, 0, ImDiskFlags.Removable , @"USB", false, driveLetter, ref deviceID, statusControl);
Console.ReadKey();
// remove device
ImDiskAPI.APIFlags = DLL.ImDiskAPIFlags.ForceDismount;
ImDiskAPI.RemoveDevice(driveLetter);
unfortunately I haven't seen any seen any examples that i can use.
although there is a very detailed documents on the methods
http://www.ltr-data.se/library/ImDiskNet/html/b33f1e89-3d92-fc08-248d-14c5c2efd549.htm
so here is a simple example how to create a USB drive and disconnect it
// get device handle and free drive letter
uint deviceID = 0;
IntPtr statusControl = IntPtr.Zero;
string driveLetter = ImDiskAPI.FindFreeDriveLetter() + ":";
// create device
// 40mb = 4096*1024*10
ImDiskAPI.CreateDevice(4096 * 1024 * 10, 0, 0, 0, 0, ImDiskFlags.Removable , @"USB", false, driveLetter, ref deviceID, statusControl);
Console.ReadKey();
// remove device
ImDiskAPI.APIFlags = DLL.ImDiskAPIFlags.ForceDismount;
ImDiskAPI.RemoveDevice(driveLetter);
Monday, December 29, 2014
TFS2013 Web.Config Transformation in Build
Hi
i have been looking around how to create web.config transformation when using tfs build.
there are 3 options:
/p: TransformConfigFiles=true
just don't forge, if you are using TFS2013 with old build templates (2010/2012) you will also need to add "/p:VisualStudioVersion=12.0"
i have been looking around how to create web.config transformation when using tfs build.
there are 3 options:
- Use publish profile - this is done by creating a publish profile (right click on the project and select publish), then add to the build definition, "MSBuild Arguments"
- Add "xmlTransform" task to the csproj - open the csproj file for edit (Unload and edit) and add right before the end
<Target Name="TransformConfigFiles" AfterTargets="AfterBuild" Condition="'$(TransformConfigFiles)'=='true'"> <ItemGroup> <DeleteAfterBuild Include="$(WebProjectOutputDir)Web.*.config" /> </ItemGroup> <TransformXml Source="Web.config" Transform="$(ProjectConfigTransformFileName)" Destination="$(WebProjectOutputDir)Web.config" /> <Delete Files="@(DeleteAfterBuild)" /> </Target>in order to control this, you need to add to the build definition, "MSBuild Arguments"
/p: TransformConfigFiles=true
- Force MSBuild to run Config transformation - this is done by add to the build definition, "MSBuild Arguments"
just don't forge, if you are using TFS2013 with old build templates (2010/2012) you will also need to add "/p:VisualStudioVersion=12.0"
Saturday, November 22, 2014
Import Unit Tests to Test Cases
Using UI Automation and Unit tests in general is a good thing,
but VS does not provide a simple way of associating the tests to test cases.
you have to open a test case and associate the unit test, for one, two it ok,
for more then 10 its very tedious
in VS2010 we had a nice extesion called "Pronto",
in VS 2012 and above this does not work any more.
luckly the TCM command comes very handy here:
tcm testcase /import /collection:http://mytfs:8080/tfs/mycollection /teamproject:"myTeamProject" /storage:"fullpath_to_UT_DLL" [/filter:"test category"] [/syncsuite:"test suite id to update"]
this command will pass over all matching unit tests in the dll and add / update testcases.
MSDN TCM link : http://msdn.microsoft.com/en-us/library/ff942470.aspx
but VS does not provide a simple way of associating the tests to test cases.
you have to open a test case and associate the unit test, for one, two it ok,
for more then 10 its very tedious
in VS2010 we had a nice extesion called "Pronto",
in VS 2012 and above this does not work any more.
luckly the TCM command comes very handy here:
tcm testcase /import /collection:http://mytfs:8080/tfs/mycollection /teamproject:"myTeamProject" /storage:"fullpath_to_UT_DLL" [/filter:"test category"] [/syncsuite:"test suite id to update"]
this command will pass over all matching unit tests in the dll and add / update testcases.
MSDN TCM link : http://msdn.microsoft.com/en-us/library/ff942470.aspx
Saturday, July 19, 2014
TFS2013 Build, New Features Overview 1
TFS2013, brought many ALM ,cource control and web access changes.
one of these changes was the integration of Git as a source control from Team projects.
another small one was adding scripts to the build templates.
TFS2013 brings us 2 new Build Templates
here the template ,as you can see it's very simple compared to the previous versions (tfs2010 /2012).
here is the exception handling
here is the finally clause of the Try. the most important activity here is the "Reset the Environment".
this activity clears all the TF build environment variable which will talk about later.
the template contains no If statements or parallel. so how does it control the activities?
simple each activity has an Enable switch.
also you might notice that there is no "for-each" like for the MSBuild like previous versions.
this means that a lot of the logic was entered to the MSBuild Activity.
you might also notice that there is no Get Build or Create workspace.
this was done to expose some common variables to the power shell scripts
one of these changes was the integration of Git as a source control from Team projects.
another small one was adding scripts to the build templates.
TFS2013 brings us 2 new Build Templates
- TFVCTemplate.12.Xaml
- GitVCTemplate.12.Xaml
here the template ,as you can see it's very simple compared to the previous versions (tfs2010 /2012).
here is the exception handling
here is the finally clause of the Try. the most important activity here is the "Reset the Environment".
this activity clears all the TF build environment variable which will talk about later.
the template contains no If statements or parallel. so how does it control the activities?
simple each activity has an Enable switch.
also you might notice that there is no "for-each" like for the MSBuild like previous versions.
this means that a lot of the logic was entered to the MSBuild Activity.
you might also notice that there is no Get Build or Create workspace.
this was done to expose some common variables to the power shell scripts
CodedUI - Running tests on remote machines
CodedUI is just one of many UI testing tools.
It's a great tool for testing UI although it has it's problems.
but this post does not talk about the problems or it's wonderful abilities.
I want to show you how you can run the codedui Test from a build machine or directly from VS2010/2012 on VMs.
first of all we need to install a Test Rig, meaning install Test Controller and Test agents
you can use the following link to do that: http://msdn.microsoft.com/en-us/library/vstudio/hh546459.aspx
P.S: since we are not using the Lab Management don't associate the controller with a collection. also make sure the test agent runs in interactive mode.
we then need to set up the test settings file to execute the test remotely and give it the test controller name.
set the test setting file as active
now we are ready to run the codedui tests and they will run on the VM.
but it fails, it says something about remote connection not active?
well yes one of the draw backs of running on VMs you need an active RDP connection and minimized is no good, it must be up.
luckily there is a workaround, every OS running as VM has a console session that is always open against the host. we use the following command to use it:
tscon RDP-Tcp#0 /Dest:Console
more information about TsCon: http://technet.microsoft.com/en-us/library/cc770988.aspx
just 2 things:
1. you are local admin on the machine (you need permissions on Console session)
2. after you run this command you are automatically disconnected!!!
because of option 2 i always add the video data collector
[image]
so i can see the test result. the CodedUI log is hard to decipher.
you will notice that the test if it failed was usually due to the low resolution of the console.
for this problem i created a special data collector that has the ability to change the resolution of the machine,
I created a "Change Resolution Data Collector".
https://onedrive.live.com/redir?resid=C4BEA458C5283F0B!270&authkey=!APVYd1IOyjoryDk&ithint=file%2c.msi
It's a great tool for testing UI although it has it's problems.
but this post does not talk about the problems or it's wonderful abilities.
I want to show you how you can run the codedui Test from a build machine or directly from VS2010/2012 on VMs.
first of all we need to install a Test Rig, meaning install Test Controller and Test agents
you can use the following link to do that: http://msdn.microsoft.com/en-us/library/vstudio/hh546459.aspx
P.S: since we are not using the Lab Management don't associate the controller with a collection. also make sure the test agent runs in interactive mode.
we then need to set up the test settings file to execute the test remotely and give it the test controller name.
set the test setting file as active
now we are ready to run the codedui tests and they will run on the VM.
but it fails, it says something about remote connection not active?
well yes one of the draw backs of running on VMs you need an active RDP connection and minimized is no good, it must be up.
luckily there is a workaround, every OS running as VM has a console session that is always open against the host. we use the following command to use it:
tscon RDP-Tcp#0 /Dest:Console
more information about TsCon: http://technet.microsoft.com/en-us/library/cc770988.aspx
just 2 things:
1. you are local admin on the machine (you need permissions on Console session)
2. after you run this command you are automatically disconnected!!!
because of option 2 i always add the video data collector
[image]
so i can see the test result. the CodedUI log is hard to decipher.
you will notice that the test if it failed was usually due to the low resolution of the console.
for this problem i created a special data collector that has the ability to change the resolution of the machine,
I created a "Change Resolution Data Collector".
https://onedrive.live.com/redir?resid=C4BEA458C5283F0B!270&authkey=!APVYd1IOyjoryDk&ithint=file%2c.msi
Sunday, April 28, 2013
Check SQL Server Installed Components
Once in while i get to a client that performs the TFS installation on his own, generally most of them do a bad installation (maybe i just go to the bad ones....)
the first thing i do is to check the SQL installation.
basically there are 2 ways:
1. Add/Remove Programs (Slow and painfully...)
2. SQL Server features discovery Report (short and informative)
to get to the report, we Open "SQL Server Installation Center"
the first thing i do is to check the SQL installation.
basically there are 2 ways:
1. Add/Remove Programs (Slow and painfully...)
2. SQL Server features discovery Report (short and informative)
to get to the report, we Open "SQL Server Installation Center"

Click on
"Tools->Installed SQL Server features discovery Report"
you'll get an HTML report of all the features installed on the machine with their version.
SQL Server Name Update
once in a while i encounter clients that only after the installation of the SQL rememeber that the server name is not what they wanted.....
normally we had to reinstall the whole server again. but luckly we can update the SQL Server name After the machine change (connection to TFS after rename is a different issue...)
run the following in SSMS:
- run "Select @@servername" to verifiy the current server name
- run the following script to update the server name sp_dropserver 'old_name'
- Restart SQL Server service. I prefer the command prompt for this, but you can just as easily do it in Services under the Control Panel
- net stop mssqlserver
- net start mssqlserver
- Then after that is done run "select @@servername" to check the new name
go
sp_addserver 'new_name','local'
go
How To: Find the SQL Version that is Installed
I Get to do a lot of TFS upgrades and migrations. there is one critical element in these actions,
that is the SQL Server, installation of a wrong version of SQL or missing some updates will cause problem restoring the databases and a big headache
so first we can use this query to check service pack and product edition (Developer / standard / Enterprise)
and check it against this site: http://sqlserverbuilds.blogspot.com/
this site contains a list of all patches and their corresponding version
that is the SQL Server, installation of a wrong version of SQL or missing some updates will cause problem restoring the databases and a big headache
so first we can use this query to check service pack and product edition (Developer / standard / Enterprise)
SELECT SERVERPROPERTY('productversion'),SERVERPROPERTY('productlevel'),SERVERPROPERTY('edition')
and for a more specific identification we can take the Version that is written in the SSMSand check it against this site: http://sqlserverbuilds.blogspot.com/
this site contains a list of all patches and their corresponding version
Saturday, April 13, 2013
Web Deployment in TFS2012 - Part 2
In the previouse post i have shown how to publish.
this we publish the whole site, but what if i need external resources or exclude some config files?
so i looked around good people and here is what i found (also validated):
Adding to the Deployment
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="D:\Dev\W2012TFS2012Prd\DefaultCollection\Test\MySites\MvcApplication\Properties\PublishProfiles\**\*" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>Extra Files\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
Exclude From Deployment
<PropertyGroup>
this we publish the whole site, but what if i need external resources or exclude some config files?
so i looked around good people and here is what i found (also validated):
Adding to the Deployment
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="D:\Dev\W2012TFS2012Prd\DefaultCollection\Test\MySites\MvcApplication\Properties\PublishProfiles\**\*" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>Extra Files\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
Exclude From Deployment
<PropertyGroup>
<ExcludeFilesFromPackageDependsOn>
$(ExcludeFilesFromPackageDependsOn);
_ExcludeAzureDlls
</ExcludeFilesFromPackageDependsOn>
</PropertyGroup>
<Target
Name="_ExcludeAzureDlls">
<ItemGroup>
<AzureFiles
Include="@(FilesForPackagingFromProject)"
Exclude="@(FilesForPackagingFromProjectWithNoAzure)" />
<ExcludeFromPackageFiles
Include="@(AzureFiles)">
<FromTarget>_ExcludeAzureEnvironmentDlls</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>
</Target>
taken from : http://pastebin.com/6BFehAG3
here is a MSDN FAQ about Web Deployment http://msdn.microsoft.com/en-us/library/ee942158.aspx it also helped abit
Web Deployement in TFS2012
Web Deployment in VS2012 relies on the new Publish framework and the use of publish profiles.
using these profile gives us the ability to create different publishing for different environments.
all that is nice and well and work splendid with the VS2012, but what with my Builds?
We have 2 options:
Also for File System Publish update publish profile like this, because of a bug in the build:
using these profile gives us the ability to create different publishing for different environments.
all that is nice and well and work splendid with the VS2012, but what with my Builds?
We have 2 options:
- Add to Build Definition, Process->Advanced->MSBuild Arguments "/p:DeployOnBuild=true /p:PublishProfile=<Publish Profile Name>"
- Add the following lines to a project configuration
<DeployOnBuild>True</DeployOnBuild>
<PublishProfile>Deploy2</PublishProfile>
<PublishProfile>Deploy2</PublishProfile>
Using option 2 works better with multiple websites in the same
solution
Also for File System Publish update publish profile like this, because of a bug in the build:
<publishUrl>$(MSBuildThisFileDirectory)..\Deployment\</publishUrl>
$(MSBuildThisFileDirectory) - the location of the pubxml in the project properties
Subscribe to:
Posts (Atom)



