Closed smaillet closed 7 years ago
Can you please share what your inline task looks like?
It's a pretty simple task to read an XML file containing build version information
<UsingTask TaskName="ParseBuildVersionXml" TaskFactory="CodeTaskFactory" AssemblyFile="$(RoslynCodeTaskFactory)">
<ParameterGroup>
<BuildVersionXml Required="true"/>
<BuildMajor Output="true"/>
<BuildMinor Output="true"/>
<BuildPatch Output="true"/>
<PreReleaseName Output="true"/>
<PreReleaseNumber Output="true"/>
<PreReleaseFix Output="true"/>
</ParameterGroup>
<Task>
<Reference Include="System.Xml.ReaderWriter"/>
<Reference Include="System.Xml.XDocument"/>
<Code Type="Fragment" Language="cs">
<![CDATA[
using( var stream = File.OpenText( BuildVersionXml ) )
{
var xdoc = System.Xml.Linq.XDocument.Load( stream, System.Xml.Linq.LoadOptions.None );
var data = xdoc.Element( "BuildVersionData" );
foreach( var attrib in data.Attributes( ) )
{
switch( attrib.Name.LocalName )
{
case "BuildMajor":
BuildMajor = attrib.Value;
break;
case "BuildMinor":
BuildMinor = attrib.Value;
break;
case "BuildPatch":
BuildPatch = attrib.Value;
break;
case "PreReleaseName":
PreReleaseName = attrib.Value;
break;
case "PreReleaseNumber":
PreReleaseNumber = attrib.Value;
break;
case "PreReleaseFix":
PreReleaseFix = attrib.Value;
break;
}
}
// correct malformed values
if( string.IsNullOrWhiteSpace( PreReleaseName ) )
{
PreReleaseNumber = "0";
PreReleaseFix = "0";
}
if( PreReleaseNumber == "0" )
{
PreReleaseFix = "0";
}
}
]]>
</Code>
</Task>
</UsingTask>
@smaillet Did you have a chance to try the new package to verify its fixed now?
The ref assemblies included in the ref folder of the package don't seem to work together correctly. (Version mismatches) In particular when building a task that uses Linq to XML I get the following warnings and errors:
So the version of System.Xml.Document has a reference to a newer version of System.Xml.ReaderWriter than what is included in the package. Which leads to an error at build time:
There's an obvious version mismatch on the assemblies that the taskfactory and msbuild are not able to resolve. (Tried builds from VS and dotnet.exe so it isn't dependent on the runtime used for MSBuild)