OK, I looked, and read, then looked some more... For the life of my I cannot figure out why my object will not return from my function! This is contained in a module within a separate file being called from another script. Everything is assigned properly BUT once this function loses scope so do the variables... How do I return the wiStore object OR set it so it does not lose scope after words.
Edit: Please note that nothing is returned, I can see the variable set in the debugger but magically it goes null after the function has finished executing.
function Get-WiStore
{
param
(
$CollectionUrl
)
Add-TfsReferences
$tfsUri = New-Object System.Uri $CollectionUrl
$tfProjectCollection = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection $tfsUri
#WHY DO YOU DISAPEAR!!!!?!?!?!?!?!?!?! :'(
$wiStore = New-Object Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore $tfProjectCollection
}
function Add-TfsReferences
{
#my *.dll references
}