Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Framework/ITranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ internal interface ITranslator : IDisposable
/// from NodePacketTypeExtensions.PacketVersion when nodes are running different MSBuild versions.
/// The negotiated version is used to conditionally serialize/deserialize fields that may
/// not be supported by older packet versions.
/// Special values:
/// <b>0</b>: Indicates Framework-to-Framework (e.g. TaskHost with CLR4 runtime) task host communication.
/// A value of 0 means version match is guaranteed since both processes are shipped together (version match validation on handshake).
/// <b>1</b>: Base version for .NET task host communication without newer features. Skips serialization of AppDomain.
/// <b>2+</b>: .NET task host communication with support for additional fields like HostServices,
/// TargetName, and ProjectFile in TaskHostConfiguration.
/// </remarks>
byte NegotiatedPacketVersion { get; set; }

Expand Down
7 changes: 5 additions & 2 deletions src/Shared/TaskHostConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,14 @@ public void Translate(ITranslator translator)
translator.Translate(ref _projectFileOfTask);
translator.Translate(ref _taskName);
translator.Translate(ref _taskLocation);
if (translator.NegotiatedPacketVersion >= 2)

// Version 0 = Framework-to-Framework (e.g. CLR4),
// Version 2+ = .NET task host with support of translation for these fields.
if (translator.NegotiatedPacketVersion == 0 || translator.NegotiatedPacketVersion >= 2)
{
translator.Translate(ref _targetName);
translator.Translate(ref _projectFile);
#if !NET35
#if !NET35
translator.Translate(ref _hostServices);
#endif
}
Expand Down
Loading