Modernize build: add package READMEs and migrate nupkgproj to NoTargets SDK#1564
Open
alinpahontu2912 wants to merge 1 commit intodotnet:mainfrom
Open
Modernize build: add package READMEs and migrate nupkgproj to NoTargets SDK#1564alinpahontu2912 wants to merge 1 commit intodotnet:mainfrom
alinpahontu2912 wants to merge 1 commit intodotnet:mainfrom
Conversation
…ts SDK - Add README.md for 7 main packages (TorchSharp, TorchAudio, TorchVision, TorchSharp-cpu, TorchSharp-cuda-linux, TorchSharp-cuda-windows, libtorch-cpu) following dotnet/runtime convention with PackageReadmeFile support - Migrate all 53 .nupkgproj files from Microsoft.NET.Sdk to Microsoft.Build.NoTargets/3.7.134 to avoid pulling in unnecessary C# compile targets for projects that only package content - Fix GetTargetPath in pkg/Directory.Build.targets to compute fake target paths directly instead of relying on TargetPathWithTargetPlatformMoniker which is not available under NoTargets SDK - Add PackageReadmeFile property and Content inclusion in pkg/Directory.Build.props, with exclusion for symbols packages Part of dotnet#1346 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes TorchSharp’s NuGet packaging infrastructure by (1) adding package READMEs for key packages and wiring them into packing, and (2) migrating packaging-only .nupkgproj projects from Microsoft.NET.Sdk to Microsoft.Build.NoTargets to avoid unnecessary compile targets during packaging.
Changes:
- Added
README.mdfiles for major packages and configuredPackageReadmeFile+ packing inclusion inpkg/Directory.Build.props. - Migrated packaging projects (
.nupkgproj) toSdk="Microsoft.Build.NoTargets/3.7.134". - Updated
pkg/Directory.Build.targetsGetTargetPathlogic for NoTargets compatibility.
Reviewed changes
Copilot reviewed 62 out of 62 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/Directory.Build.props | Sets PackageReadmeFile and packs README when present; continues central packaging properties/content rules. |
| pkg/Directory.Build.targets | Updates GetTargetPath to compute a “fake” target path under PackagePreparationPath for ProjectReference consumers. |
| pkg/TorchSharp/README.md | Adds NuGet package README for TorchSharp. |
| pkg/TorchSharp/TorchSharp.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/TorchAudio/README.md | Adds NuGet package README for TorchAudio. |
| pkg/TorchAudio/TorchAudio.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/TorchVision/README.md | Adds NuGet package README for TorchVision. |
| pkg/TorchVision/TorchVision.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/TorchSharp-cpu/README.md | Adds NuGet package README for TorchSharp-cpu convenience package. |
| pkg/TorchSharp-cpu/TorchSharp-cpu.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/TorchSharp-cuda-linux/README.md | Adds NuGet package README for TorchSharp-cuda-linux convenience package. |
| pkg/TorchSharp-cuda-linux/TorchSharp-cuda-linux.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/TorchSharp-cuda-windows/README.md | Adds NuGet package README for TorchSharp-cuda-windows convenience package. |
| pkg/TorchSharp-cuda-windows/TorchSharp-cuda-windows.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cpu/README.md | Adds NuGet package README for libtorch-cpu meta package. |
| pkg/libtorch-cpu/libtorch-cpu.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cpu-linux-x64/libtorch-cpu-linux-x64.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cpu-osx-arm64/libtorch-cpu-osx-arm64.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cpu-win-arm64/libtorch-cpu-win-arm64.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cpu-win-x64/libtorch-cpu-win-x64.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64/libtorch-cuda-12.8-linux-x64.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part1/libtorch-cuda-12.8-linux-x64-part1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part2-fragment1/libtorch-cuda-12.8-linux-x64-part2-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part2-primary/libtorch-cuda-12.8-linux-x64-part2-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part3-fragment1/libtorch-cuda-12.8-linux-x64-part3-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part3-fragment2/libtorch-cuda-12.8-linux-x64-part3-fragment2.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part3-fragment3/libtorch-cuda-12.8-linux-x64-part3-fragment3.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part3-fragment4/libtorch-cuda-12.8-linux-x64-part3-fragment4.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part3-fragment5/libtorch-cuda-12.8-linux-x64-part3-fragment5.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part3-fragment6/libtorch-cuda-12.8-linux-x64-part3-fragment6.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part3-primary/libtorch-cuda-12.8-linux-x64-part3-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part4-fragment1/libtorch-cuda-12.8-linux-x64-part4-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part4-primary/libtorch-cuda-12.8-linux-x64-part4-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part5-fragment1/libtorch-cuda-12.8-linux-x64-part5-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part5-fragment2/libtorch-cuda-12.8-linux-x64-part5-fragment2.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part5-primary/libtorch-cuda-12.8-linux-x64-part5-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part6/libtorch-cuda-12.8-linux-x64-part6.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part7-fragment1/libtorch-cuda-12.8-linux-x64-part7-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part7-fragment2/libtorch-cuda-12.8-linux-x64-part7-fragment2.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part7-fragment3/libtorch-cuda-12.8-linux-x64-part7-fragment3.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part7-primary/libtorch-cuda-12.8-linux-x64-part7-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part8-fragment1/libtorch-cuda-12.8-linux-x64-part8-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part8-primary/libtorch-cuda-12.8-linux-x64-part8-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part9-fragment1/libtorch-cuda-12.8-linux-x64-part9-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-linux-x64-part9-primary/libtorch-cuda-12.8-linux-x64-part9-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64/libtorch-cuda-12.8-win-x64.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part1/libtorch-cuda-12.8-win-x64-part1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part10/libtorch-cuda-12.8-win-x64-part10.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part2/libtorch-cuda-12.8-win-x64-part2.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part3-fragment1/libtorch-cuda-12.8-win-x64-part3-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part3-primary/libtorch-cuda-12.8-win-x64-part3-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part4/libtorch-cuda-12.8-win-x64-part4.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part5-fragment1/libtorch-cuda-12.8-win-x64-part5-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part5-fragment2/libtorch-cuda-12.8-win-x64-part5-fragment2.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part5-primary/libtorch-cuda-12.8-win-x64-part5-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part6/libtorch-cuda-12.8-win-x64-part6.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part7-fragment1/libtorch-cuda-12.8-win-x64-part7-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part7-primary/libtorch-cuda-12.8-win-x64-part7-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part8/libtorch-cuda-12.8-win-x64-part8.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part9-fragment1/libtorch-cuda-12.8-win-x64-part9-fragment1.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part9-fragment2/libtorch-cuda-12.8-win-x64-part9-fragment2.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
| pkg/libtorch-cuda-12.8-win-x64-part9-primary/libtorch-cuda-12.8-win-x64-part9-primary.nupkgproj | Switches packaging project SDK to Microsoft.Build.NoTargets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+10
to
15
| <!-- Compute a fake target path from PackagePreparationPath so that ProjectReference consumers | ||
| can resolve a dependency. This replaces the TargetPathWithTargetPlatformMoniker-based approach | ||
| which is not available under Microsoft.Build.NoTargets. --> | ||
| <ItemGroup> | ||
| <_targetPathUnderPackagePrep Include="@(TargetPathWithTargetPlatformMoniker->'$(PackagePreparationPath)$(PackageIdFolderName)\lib\$(TargetFramework)\%(FileName)%(Extension)')" /> | ||
| <_targetPathUnderPackagePrep Include="$(PackagePreparationPath)$(PackageIdFolderName)\lib\$(TargetFramework)\$(PackageIdFolderName).dll" /> | ||
| <_updatedTargetPath Include="@(_targetPathUnderPackagePrep)" Condition="Exists('%(Identity)')" /> |
Comment on lines
52
to
55
| <IsSymbolsPackage Condition="$(MSBuildProjectName.Contains('.symbols'))">true</IsSymbolsPackage> | ||
| <PackageIdFolderName>$(MSBuildProjectName.Replace('.symbols', ''))</PackageIdFolderName> | ||
| <PackageReadmeFile Condition="'$(IsSymbolsPackage)' != 'true' AND Exists('$(MSBuildProjectDirectory)\README.md')">README.md</PackageReadmeFile> | ||
|
|
Comment on lines
+80
to
+82
| <ItemGroup Condition="'$(PackageReadmeFile)' != ''"> | ||
| <Content Include="$(MSBuildProjectDirectory)\README.md" Pack="true" PackagePath="" /> | ||
| </ItemGroup> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First step toward modernizing TorchSharp's build infrastructure per #1346. This PR adds NuGet package READMEs and migrates all .nupkgproj packaging projects from the full C# SDK to Microsoft.Build.NoTargets.
Problem/Motivation
Per #1346, the .nupkgproj files use Sdk="Microsoft.NET.Sdk" despite never compiling C# code — they exist solely to package content. This pulls in unnecessary C# compile targets (Compile, CoreCompile, ResolveAssemblyReferences) that slow builds and can produce confusing warnings. Additionally, no packages include README files, which is standard practice for NuGet packages.
Solution
Package READMEs
NoTargets SDK Migration
Changes
New files
Modified files
Testing
Checklist