Call a msbuild task that receives a required Guid argument

165 views Asked by At

I'm writing an msbuild script, which needs to call a task that expects a required input argument of type System.Guid. Every attempt I've made to invoke the task, fails at runtime with the msbuild error MSB4030, which says that the value is not valid for the argument, which is of type "System.Guid". I don't have the exact english error message because I'm in a spanish installation (irrelevant for the issue I hope).

I'm trying to set the task argument value in the following way:

<Target Name="SomeTarget">
  <PropertyGroup>
    <SomeGuidValue>955EC4F6-BE42-4249-9DED-FFE475E71824</SomeGuidValue>
  </PropertyGroup>
  <SomeTaskWithGuidArgument ThisIsTheGuidArgument="$(SomeGuidValue)" />
</Target>

I've also tried to inline the property value to the task argument, with no success. Also tried some other guid formats as seen in msdn documentation of System.Guid.ToString(), with no success either.

What am I doing wrong? Is there a supported way to call this task?

Thanks

1

There are 1 answers

1
makhdumi On

As far as I know, MSBuild only parses basic types for you. The task shouldn't be expecting a System.Guid parameter - it should take in a string and convert that itself.

See this discussion on the Microsoft forums for further validation that MSBuild doesn't parse GUIDs for the task. They also recently made MSBuild open-source, so you could dig around in there to verify this.