Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting and importing TFS2013 default template builds fails for the tests section #8

Open
pvandervelde opened this issue Jan 15, 2015 · 14 comments

Comments

@pvandervelde
Copy link

When exporting and importing a TFS2013 standard build definition the test section of the build information is not written out to the json correctly which means that the import fails to import any of the test information.

@mikefourie-zz
Copy link
Collaborator

What version of the extension are you using?

@mduberstein
Copy link

image
importbug

I have the same problem with version 2.12.0.18.

@mduberstein
Copy link

Sorry, TFS version is 2012. Visual Studio version is 2013.

@mikefourie-zz
Copy link
Collaborator

could you download the template you are using and attach it here. I only have 2013 at hand, it may be the same but I may as well debug it with exactly what you are using...

thanks!

,Mike

@mduberstein
Copy link

Hi Mike,
No problem. Attached.

Thanks!
Michael

On Wed, Mar 18, 2015 at 6:05 PM, Mike Fourie [email protected]
wrote:

could you download the template you are using and attach it here. I only
have 2013 at hand, it may be the same but I may as well debug it with
exactly what you are using...

thanks!

,Mike


Reply to this email directly or view it on GitHub
#8 (comment)
.
DefaultTemplate.11.1.xaml

/x:Members this:Process.BuildSettings[New Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings()]/this:Process.BuildSettings this:Process.DisableTests[False]/this:Process.DisableTests this:Process.TestSpecs[New Microsoft.TeamFoundation.Build.Workflow.Activities.TestSpecList(New Microsoft.TeamFoundation.Build.Workflow.Activities.AgileTestPlatformSpec("***test*.dll"))]/this:Process.TestSpecs this:Process.BuildNumberFormat["$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)"]/this:Process.BuildNumberFormat this:Process.SolutionSpecificBuildOutputs[False]/this:Process.SolutionSpecificBuildOutputs this:Process.AssociateChangesetsAndWorkItems[True]/this:Process.AssociateChangesetsAndWorkItems this:Process.CreateWorkItem[True]/this:Process.CreateWorkItem this:Process.CleanWorkspace[Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.All]/this:Process.CleanWorkspace this:Process.MSBuildArguments /this:Process.MSBuildArguments this:Process.RunCodeAnalysis[Microsoft.TeamFoundation.Build.Workflow.Activities.CodeAnalysisOption.AsConfigured]/this:Process.RunCodeAnalysis this:Process.MSBuildMultiProc[True]/this:Process.MSBuildMultiProc this:Process.MSBuildPlatform[Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto]/this:Process.MSBuildPlatform this:Process.PerformTestImpactAnalysis[True]/this:Process.PerformTestImpactAnalysis this:Process.SourceAndSymbolServerSettings[New Microsoft.TeamFoundation.Build.Workflow.Activities.SourceAndSymbolServerSettings(True, Nothing)]/this:Process.SourceAndSymbolServerSettings this:Process.CreateLabel[True]/this:Process.CreateLabel this:Process.GetVersion /this:Process.GetVersion this:Process.AgentSettings[New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly }]/this:Process.AgentSettings this:Process.Verbosity[Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]/this:Process.Verbosity this:Process.Metadata mtbw:ProcessParameterMetadataCollection /mtbw:ProcessParameterMetadataCollection /this:Process.Metadata this:Process.SupportedReasonsAll/this:Process.SupportedReasons this:Process.BuildProcessVersion11.0/this:Process.BuildProcessVersion mva:VisualBasic.SettingsAssembly references and imported namespaces serialized as XML namespaces/mva:VisualBasic.Settings /mtbwa:InvokeForReason mtbwa:AgentScope.Variables /mtbwa:AgentScope.Variables mtbwa:SyncWorkspace.RequestsFailed /mtbwa:SyncWorkspace.RequestsFailed /mtbwa:SyncWorkspace /mtbwa:InvokeForReason /mtbwa:InvokeForReason /mtbwa:InvokeForReason /mtbwa:InvokeForReason mtbwa:InvokeForReason.Variables /mtbwa:InvokeForReason.Variables /mtbwa:SharedResourceScope /mtbwa:InvokeForReason /mtbwa:AgentScope /mtbwa:InvokeForReason

@mduberstein
Copy link

Mike,
I copied and pasted the template in the comment above.

@mikefourie-zz
Copy link
Collaborator

Thanks I have a repro. Will try get a fix in for you soon.

@mduberstein
Copy link

Looking forward. Thank you.

@mikefourie-zz
Copy link
Collaborator

@mduberstein let me know if that works for you

@mduberstein
Copy link

@mikefourie It didn't, no errors are produced, but the entire Automated Test entry becomes empty
I have downloaded the .zip code
Suppressed analyzer errors

MSBUILD : error CA2227: Microsoft.Usage : Change 'ExportedBuildDefinition.AgileTestSpecs' to be read-only by removing the property setter.
2>MSBUILD : error CA1002: Microsoft.Design : Change 'List' in 'ExportedBuildDefinition.AgileTestSpecs' to use Collection, ReadOnlyCollection or KeyedCollection<K,V>
2> Code Analysis Complete -- 3 error(s), 0 warning(s)
2>MSBUILD : error : Code Analysis detected errors. See Code Analysis results window or log file for details.

built the entire solution's Release Built, uninstalled version 2.12.0.18 installed 2.12.0.19 TFSBuildManager.Package.vsix.

image

As you could see the entire Automated Test section is stripped.

@mduberstein
Copy link

@mikefourie I attach the old and new .json,
The only difference is "AgileTestSpecs": [] added in 2.12.0.19.
No data is exported though :-(. Thanks.

2.12.0.18

{
"Name": "DeployLab3",
"Description": "Clone of DeployLab2 with logging straight to TFS, not log files\r\nCreated to experiment with build definition to make web.config transform work and packages find msdeploy on target servers.\r\n",
"ContinuousIntegrationType": 1,
"BuildController": "Default Controller - ritfsbldt1",h
"ProjectsToBuild": [
"$/Study Baseline/Main/Build/Deploy3.proj"
],
"ConfigurationsToBuild": null,
"QueueStatus": 0,
"ProcessTemplate": "$/Study Baseline/BuildProcessTemplates/DefaultTemplate.11.1.xaml",
"DefaultDropLocation": "",
"TfvcAgentSettings": null,
"GitAgentSettings": null,
"Schedules": [],
"ContinuousIntegrationQuietPeriod": 0,
"SourceProviders": [
{
"Name": "TFVC",
"SupportedTriggerTypes": 127,
"Fields": {}
}
],
"Mappings": [
{
"MappingType": 0,
"LocalItem": "$(SourceDir)",
"ServerItem": "$/Study Baseline/Main/Build",
"Depth": 120
},
{
"MappingType": 0,
"LocalItem": "$(SourceDir)\ROME Central Setup",
"ServerItem": "$/Study Baseline/Main/Build/ROME Central Setup",
"Depth": 120
},
{
"MappingType": 0,
"LocalItem": "$(SourceDir)_Data",
"ServerItem": "$/Study Baseline/Main/Databases/RomeDatabase/_Data",
"Depth": 120
},
{
"MappingType": 0,
"LocalItem": "$(SourceDir)_Scripts",
"ServerItem": "$/Study Baseline/Main/Databases/RomeDatabase/Scripts",
"Depth": 120
}
],
"TestParameters": null,
"RetentionPolicyList": [
{
"BuildDefinition": null,
"BuildReason": 64,
"BuildStatus": 2,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 64,
"BuildStatus": 4,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 64,
"BuildStatus": 8,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 64,
"BuildStatus": 16,
"NumberToKeep": 1,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 191,
"BuildStatus": 2,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 191,
"BuildStatus": 4,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 191,
"BuildStatus": 8,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 191,
"BuildStatus": 16,
"NumberToKeep": 1,
"DeleteOptions": 29
}
],
"ProcessParameters": {
"BuildSettings": "Build $/Study Baseline/Main/Build/Deploy3.proj with default platform and configuration",
"TestSpecs": [
"From Test Settings - Run tests in assemblies matching *
_test*.dll using settings from $/Study Baseline/Main/Windows7_Chrome.testsettings"
],
"MSBuildArguments": "/p:WebServer=ritfslab01t1;SqlServer=ritfslab01t1;Environment=testing",
"DisableTests": true,
"Verbosity": 3
},
"BuildReasons": {},
"IntegerParameters": {},
"BuildVerbosities": {
"Verbosity": 3
}

}

2.12.0.19

{
"Name": "DeployLab3_clone",
"Description": "Clone of DeployLab2 with logging straight to TFS, not log files\r\nCreated to experiment with build definition to make web.config transform work and packages find msdeploy on target servers.\r\n",
"ContinuousIntegrationType": 1,
"BuildController": "Default Controller - ritfsbldt1",
"AgileTestSpecs": [],
"ProjectsToBuild": [
"$/Study Baseline/Main/Build/Deploy3.proj"
],
"ConfigurationsToBuild": null,
"QueueStatus": 0,
"ProcessTemplate": "$/Study Baseline/BuildProcessTemplates/DefaultTemplate.11.1.xaml",
"DefaultDropLocation": "",
"TfvcAgentSettings": null,
"GitAgentSettings": null,
"Schedules": [],
"ContinuousIntegrationQuietPeriod": 0,
"SourceProviders": [
{
"Name": "TFVC",
"SupportedTriggerTypes": 127,
"Fields": {}
}
],
"Mappings": [
{
"MappingType": 0,
"LocalItem": "$(SourceDir)",
"ServerItem": "$/Study Baseline/Main/Build",
"Depth": 120
},
{
"MappingType": 0,
"LocalItem": "$(SourceDir)\ROME Central Setup",
"ServerItem": "$/Study Baseline/Main/Build/ROME Central Setup",
"Depth": 120
},
{
"MappingType": 0,
"LocalItem": "$(SourceDir)_Data",
"ServerItem": "$/Study Baseline/Main/Databases/RomeDatabase/_Data",
"Depth": 120
},
{
"MappingType": 0,
"LocalItem": "$(SourceDir)_Scripts",
"ServerItem": "$/Study Baseline/Main/Databases/RomeDatabase/Scripts",
"Depth": 120
}
],
"TestParameters": null,
"RetentionPolicyList": [
{
"BuildDefinition": null,
"BuildReason": 64,
"BuildStatus": 2,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 64,
"BuildStatus": 4,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 64,
"BuildStatus": 8,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 64,
"BuildStatus": 16,
"NumberToKeep": 1,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 191,
"BuildStatus": 2,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 191,
"BuildStatus": 4,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 191,
"BuildStatus": 8,
"NumberToKeep": 10,
"DeleteOptions": 29
},
{
"BuildDefinition": null,
"BuildReason": 191,
"BuildStatus": 16,
"NumberToKeep": 1,
"DeleteOptions": 29
}
],
"ProcessParameters": {
"BuildSettings": "Build $/Study Baseline/Main/Build/Deploy3.proj with default platform and configuration",
"TestSpecs": [
"From Test Settings - Run tests in assemblies matching *
_test*.dll using settings from $/Study Baseline/Main/Windows7_Chrome.testsettings"
],
"MSBuildArguments": "/p:WebServer=ritfslab01t1;SqlServer=ritfslab01t1;Environment=testing",
"DisableTests": true,
"Verbosity": 3
},
"BuildReasons": {},
"IntegerParameters": {},
"BuildVerbosities": {
"Verbosity": 3
}
}

@mikefourie-zz
Copy link
Collaborator

if you break on line 452 in TFSBuildManager.Views\ViewModels\BuildManagerViewModel.cs I suspect you will be using MSTestSpec rather than agiletestspec. I'll try add support for MSTestSpec soon.

@andrelvahter
Copy link

Hi,

Trying to export/import some build definitions from one TFS to VSO.
In general it works (y) greate job.

But seems Advanced builds settings are exported incorrectly. They are missing [ ] around the Json array. The export is

"AdvancedBuildSettings": {
  "Json": "{\"MSBuildArguments\":\"\",\"MSBuildMultiProc\":true,\"MSBuildPlatform\":\"Auto\",\"PreActionScriptPath\............"\",\"MSBuildVersion\":\"\"}"
},

So when I try to import the same exported Json I get a error. "Specified cast is not valid."
If I add [] around it (like the other similar values it works.

"AdvancedBuildSettings":[ {
  "Json": "{\"MSBuildArguments\":\"\",\"MSBuildMultiProc\":true,\"MSBuildPlatform\":\"Auto\",\"PreActionScriptPath\............"\",\"MSBuildVersion\":\"\"}"
}],

@andrelvahter
Copy link

Hi,
Found the problem with my templates when doing a Import/Export.
Needed to tweak the code a little since we have custom templates.

Our Unit test section is a BuildParameter array so needed to add some "special cases.
For Import
else if (param.Key == "AutomatedTests")
{
BuildParameter[] paramItem = new BuildParameter[1]{new Microsoft.TeamFoundation.Build.Common.BuildParameter(param.Value.ToString())};
process.Add(param.Key, paramItem);
}

For Export.
if (item.Key == "AutomatedTests")
{
BuildParameter[] avalue = (BuildParameter[])item.Value;
buildToExport.ProcessParameters[item.Key] = JsonConvert.DeserializeObject(avalue[0].ToString());
}

After that my templates where imported/exported successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants