msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

MSBuild task for creating Tar files

Open stan-sz opened this issue 3 years ago • 16 comments

With .Net 7 support for tar apis, is it feasible to create an equivalent of (Un)ZipDirectory tasks for handling .tar files in the upcoming MSBuild release?

stan-sz avatar Sep 05 '22 17:09 stan-sz

Cc @carlossanlop fyi

danmoseley avatar Sep 05 '22 17:09 danmoseley

Would such a task be able to work when MSBuild is run on .NET Framework? System.Formats.Tar doesn't appear to target anything compatible with that.

https://github.com/dotnet/runtime/blob/eecb02807867cad56cd05badddef65e432248b75/src/libraries/System.Formats.Tar/src/System.Formats.Tar.csproj#L3

KalleOlaviNiemitalo avatar Sep 05 '22 21:09 KalleOlaviNiemitalo

No it would only work on .NET 7 and later. I believe that would mean .NET SDK 7.0.something and later, targeting any version.

danmoseley avatar Sep 05 '22 21:09 danmoseley

We don't yet have any inbox tasks that are .NET (core) only, which might be enough to delay this. But I think it sounds like a reasonable idea.

rainersigwald avatar Sep 06 '22 14:09 rainersigwald

If a task that requires .NET is added and a user tries to run it on .NET Framework, I hope it will log an error saying that the task doesn't support .NET Framework, rather than MSB4036.

https://github.com/dotnet/msbuild/blob/9c46407735ef0afede0c481069acc2ea8704c510/src/Build/Resources/xlf/Strings.xlf#L573-L576

KalleOlaviNiemitalo avatar Sep 06 '22 14:09 KalleOlaviNiemitalo

@KalleOlaviNiemitalo Yes, if the UsingTask is authored correctly (that is, specifies that the task is .NET-only).

rainersigwald avatar Sep 06 '22 14:09 rainersigwald

I see, you added support for Runtime="NET" in https://github.com/dotnet/msbuild/pull/6994. It doesn't seem to be documented yet, so I filed https://github.com/MicrosoftDocs/visualstudio-docs/issues/8436.

KalleOlaviNiemitalo avatar Sep 06 '22 15:09 KalleOlaviNiemitalo

This is a great idea, and we should do it.

However, this task would require a .NET 7 Runtime, which brings up an interesting conundrum. That would require MSBuild to update its Target Framework to net7.0, but for support reasons we really really try to keep components that ship in the .NET SDK to Long-Term-Support Target Frameworks. We're having a discussion about the mechanics of this later this week, but in general because of SDK and Visual Studio support cycles and overlaps (or lack thereof) between the two, we try to limit the amount of STS (short-term support)-only features we use in the product to enable us to fallback to run on supported runtimes when the STS stables go out of support.

That would mean that this Task would either need to be conditioned somehow, or wait until we start targeting net8.0 for MSBuild (which would be something like the 17.8 MSBuild/VS version numbers if memory serves).

baronfel avatar Sep 07 '22 20:09 baronfel

In that case, blocked on https://github.com/dotnet/msbuild/pull/7790 and should be conditioned. We can add this to the next spring planning and discuss it then. Conditioning out the task should be easy enough.

benvillalobos avatar Sep 15 '22 17:09 benvillalobos

@BenVillalobos can this work be scheduled for a minor release still in 7.0 timeframe (before .NET 8.0)?

stan-sz avatar Nov 18 '22 11:11 stan-sz

@stan-sz MSBuild releases on the .NET SDK and Visual Studio cadence, so can add features ~quarterly.

rainersigwald avatar Nov 18 '22 15:11 rainersigwald

A kind reminder about this feature request, @benvillalobos and @rainersigwald. Thanks!

stan-sz avatar Nov 21 '23 14:11 stan-sz

@stan-sz Are you ok with this only working in dotnet build, and not working in Visual Studio/MSBuild.exe?

rainersigwald avatar Nov 27 '23 17:11 rainersigwald

I would also love to see this. I'm currently doing this, which is... not great, for multiple reasons. (It only working in dotnet build would be fine in my case, since these projects are never evaluated/built from anything else, for whatever that's worth.)

alexrp avatar Dec 12 '23 02:12 alexrp

@stan-sz Are you ok with this only working in dotnet build, and not working in Visual Studio/MSBuild.exe?

Yes

stan-sz avatar Dec 18 '23 08:12 stan-sz

@rainersigwald - a kind reminder so this task makes it to the release. Thanks!

stan-sz avatar Jan 23 '24 07:01 stan-sz