Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use csproj as pack input instead of nuspec #1119

Merged
merged 7 commits into from
Nov 6, 2024

Conversation

ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Oct 27, 2023

Now that sourcelink is a native part of the .NET SDK, Arcade doesn't bring sourcelink packages in anymore. Now that the cyclic package dependency is avoided, these projects don't need to use nuspecs anymore.

This removes custom infrastructure and hacks, and allows better source build controls.

I diffed the produced packages and the content is identical (a deps.json file is added but that's recommended by msbuild for build tasks these days).

@KalleOlaviNiemitalo
Copy link

Does the team intend to keep publishing sourcelink NuGet packages for use with older SDKs?

@ViktorHofer
Copy link
Member Author

ViktorHofer commented Oct 27, 2023

Does the team intend to keep publishing sourcelink NuGet packages for use with older SDKs?

I'm not the owner of sourcelink but AFAIK yes and this PR doesn't change that. The .NET 9 source link packages will work on all the officially supported MSBuild flavours and supported runtimes.

@ViktorHofer
Copy link
Member Author

Unfortunately I can't reproduce the failures locally: Microsoft.SourceLink.Git.IntegrationTests.

ViktorHofer added a commit to dotnet/arcade that referenced this pull request Oct 31, 2023
@ViktorHofer ViktorHofer force-pushed the UsePackTaskInsteadOfNuspec branch 2 times, most recently from c575a10 to 42c31c5 Compare November 2, 2023 09:10
@ViktorHofer
Copy link
Member Author

cc @tmat

@jaredpar
Copy link
Member

jaredpar commented Nov 2, 2023

@davidwengier can you take a look at this?

Copy link
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

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

We should avoid including the TFM in the tools package path. It makes things unnecessarily complicated.

@ViktorHofer ViktorHofer force-pushed the UsePackTaskInsteadOfNuspec branch 12 times, most recently from a8489fb to 481ba16 Compare February 1, 2024 15:09
@ViktorHofer ViktorHofer requested a review from tmat February 1, 2024 15:19
@ViktorHofer
Copy link
Member Author

I finally found time to continue to work on this. @tmat, please take a look. I used the same approach that we came up with in arcade for build task projects. Btw, it would be good to switch this repository to Central Package Management with a future change.

Now that sourcelink is a native part of the .NET SDK, Arcade doesn't
bring sourcelink packages in anymore. Now that the cyclic package
dependency is avoided, these projects don't need to use nuspecs
anymore.

This removes custom infrastructure and allows better source build
controls.

I diffed the produced packages and the content in the .NETCoreApp
folder is identical (a deps.json file is added but that's
recommended by msbuild for build tasks these days). The .NET Framework
output is significantly different as it now includes all dependencies
that aren't supplied by the MSBuild inside Visual Studio.
@tmat
Copy link
Member

tmat commented Feb 2, 2024

The .NET Framework output is significantly different as it now includes all dependencies that aren't supplied by the MSBuild inside Visual Studio.

Would you mind listing the differences?

eng/BuildTask.targets Outdated Show resolved Hide resolved
@ViktorHofer
Copy link
Member Author

Would you mind listing the differences?

Sure. I will post the nuspec diffs next week.

README.md Outdated Show resolved Hide resolved
@ViktorHofer
Copy link
Member Author

ViktorHofer commented Aug 20, 2024

@tmat now I really finally got to finishing this PR.

I just diffed the package contents before and after this change and noticed a bug that resulted in assemblies being copied into the package layout unnecessarily. This is now fixed and the diff doesn't show any unexpected changes. The expected ones are:

  • net472 folder name -> netframework, core folder name -> net with the corresponding .props/.targets changes
  • The nuspec now lists dependencies per TFM (that's the default behavior when using the NuGet pack task). Aside from a more verbose listing, this doesn't harm.
  • The License.TXT file is now included (arcade setting)
  • The build task assemblies now include their .deps.json / .config files. That's expected and the msbuild team recommends shipping those along an msbuild package.
  • My local commit is different

Example files diff:

image

(Ignore the package, _rels folder and the ContentType.xml file -> those are things that NuGet creates automatically)

Example nuspec diff:

image

@ViktorHofer ViktorHofer requested a review from tmat August 20, 2024 15:48
@ViktorHofer
Copy link
Member Author

@tmat when you are back from holiday, please take a look. Thanks in advance.

@ViktorHofer
Copy link
Member Author

@tmat gentle ping

@@ -0,0 +1,112 @@
<!-- Copied from arcade with small modifications. -->
Copy link
Member

Choose a reason for hiding this comment

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

It'd be nice to share this rather than making a copy.

Copy link
Member Author

Choose a reason for hiding this comment

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

The msbuild team is working on an epic to make msbuild plugin (task) development easier: dotnet/msbuild#10733

That will replace all this when it gets implemented (planned for .NET 10).

@ViktorHofer ViktorHofer requested a review from tmat October 28, 2024 15:01
@ViktorHofer
Copy link
Member Author

@tmat PTAL

@ViktorHofer
Copy link
Member Author

gentle ping @tmat

@ViktorHofer ViktorHofer merged commit 474ceee into dotnet:main Nov 6, 2024
10 checks passed
@ViktorHofer ViktorHofer deleted the UsePackTaskInsteadOfNuspec branch November 6, 2024 16:01
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