Skip to content

Expose GetFileHash & VerifyFileHash for .NET Core#3999

Merged
rainersigwald merged 1 commit intodotnet:masterfrom
iainnicol:filehash
Dec 12, 2018
Merged

Expose GetFileHash & VerifyFileHash for .NET Core#3999
rainersigwald merged 1 commit intodotnet:masterfrom
iainnicol:filehash

Conversation

@iainnicol
Copy link
Copy Markdown
Contributor

@iainnicol iainnicol commented Dec 10, 2018

These tasks already exist in Microsoft.Build.Tasks.Core.dll, but were
not exposed with a <UsingTask>. I presume this is an oversight. In
contrast, these tasks are already exposed from
Microsoft.Build.Tasks.v4.0, with a <UsingTask>.

Copy link
Copy Markdown
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Those tasks are new (added in #3398) and not exposed from the v4.0, so only the new lines you're adding make sense.

Can you please delete the existing lines as part of this PR as well?

The implementation of these tasks already existed.  However, these tasks
are quite new, and their existing ``<UsingTask>`` element referenced the
wrong assembly.
@iainnicol
Copy link
Copy Markdown
Contributor Author

iainnicol commented Dec 10, 2018

Yes, I like the bleeding edge :).

Thanks for the explanation. I had assumed that .NET Framework MSBuild uses Microsoft.Build.Tasks.v4.0.dll, and .NET Core MSBuild uses Microsoft.Build.Tasks.Core.dll. But I now see that MSBuild, for both Framework and Core, ships Microsoft.Build.Tasks.Core.dll. Also, Microsoft.Build.Tasks.v4.0.dll is shipped separately, in the .NET Framework. Yeah?

Existing lines deleted.

Copy link
Copy Markdown
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@rainersigwald rainersigwald merged commit c8492eb into dotnet:master Dec 12, 2018
@japj
Copy link
Copy Markdown

japj commented Jan 28, 2019

ah, this explains why I couldn't use these tasks in VS2017 15.8. When will this be shipped (and does it include an update xsd by any chance)?

@rainersigwald
Copy link
Copy Markdown
Member

@japj The fix will be in 16.0 (it should be in Preview 2 released last week).

As a workaround for older versions, you can include explicit UsingTasks before your usage of the task. If you include a condition on $(MSBuildVersion) you can keep it compatible with fixed MSBuilds.

    <UsingTask TaskName="Microsoft.Build.Tasks.GetFileHash"                           AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition="'$(MSBuildVersion)' < '16.0.360'" />
    <UsingTask TaskName="Microsoft.Build.Tasks.VerifyFileHash"                        AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition="''$(MSBuildVersion)' < '16.0.360'" />

<Target Name="Whatever">
 <GetFileHash ... />
</Target>

and does it include an update xsd by any chance

It does not, but should. Filed #4103.

@japj
Copy link
Copy Markdown

japj commented Jan 29, 2019

@rainersigwald great! Thanks for the info and updating the documentation!

rainersigwald added a commit that referenced this pull request Jan 31, 2019
We opted not to retain the typo in the metadata name as a backward-compatibility measure, because 
the task was new and very difficult to use before #3999.
@hickford
Copy link
Copy Markdown
Contributor

hickford commented Apr 5, 2024

@rainersigwald After fixing some typos, the workaround worked for me:

<UsingTask TaskName="Microsoft.Build.Tasks.GetFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition="'$(MSBuildVersion)' &lt; '16.0.360'" />
<UsingTask TaskName="Microsoft.Build.Tasks.VerifyFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition="'$(MSBuildVersion)' &lt; '16.0.360'" />

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

Successfully merging this pull request may close these issues.

4 participants