Open rainersigwald opened 7 years ago
@rainersigwald I probably won't be able to do this in dev15.3 timeframe. I'll move to following milestone. Let me know if that causes pain.
That should be fine. While making an unrelated change, I realized there is one wrinkle: you'll also need to continue to provide the DestinationPath
output (in Copy
it's named DestinationFiles
). But that is easy.
Along with this change, it would probably be good to find a way to unittest this Task in the Roslyn repo (it will make it easier to review/accept the PR).
My testing strategy so far was manual, following these steps and then trying various scenarios:
build\Toolset
(this puts all the MSBuild and Roslyn binaries in .nuget/packages/roslyntools.msbuild/0.2.0-alpha/tools/msbuild/MSBuild.exe
or some similar folder with different version number)CopyRefAssembly
with <dir>/.nuget/packages/roslyntools.msbuild/0.2.0-alpha/tools/msbuild/MSBuild.exe /t:MyTarget /v:diag
MSBuild.exe
as a project in Visual Studio, then configure those parameters and working folder in the Debug settings for the project, then F5 to debug the Task.<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="CopyRefAssembly" AssemblyFile="D:\repos\roslyn\Binaries\Debug\Dlls\MSBuildTask\Microsoft.Build.Tasks.CodeAnalysis.dll"/>
<Target Name="MyTarget">
<CopyRefAssembly SourcePath="..." DestinationPath="..."/>
</Target>
</Project>
The new
CopyRefAssembly
task has logic to determine whether a reference assembly is logically identical by comparing MVIDs of the source and destination files. If the MVIDs do not match, it copies the source assembly to the destination path.As currently implemented, this copy doesn't have all of the bells and whistles of the
Copy
task, which supports retries and special-cases a number of scenarios.CopyRefAssembly
could inherit fromCopy
, overrideExecute()
, do its up-to-date checks, and then after deciding to copy, forward tobase.Execute()
to get all of the additional magic.This came up when discussing https://github.com/Microsoft/msbuild/issues/1986 with @jeffkl.
@jcouv -- something to think about. Doesn't block the initial implementation, since no MSBuild change would be required to pick this up.