You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Doc enhancement: How can I quickly build the NuGet package for a single library that ships out of dotnet/runtime? #32249
Once built, I can find it in E:\GitHub\Fork\runtime\artifacts\packages\Debug\Shipping (along with all the other packages), add the local directory to my NuGet.Config, reference it from a console app project, and then dogfood it. We should update and capture the dogfooding steps in docs.
Is there a better/faster way to do so and can we improve the inner dev loop for that, where I don't have to build all the packages?
Is there a better/faster way to do so and can we improve the inner dev loop for that, where I don't have to build all the packages?
What we could do is introduce a property like PackageToBuild so that you do build.cmd -subsetCategory libraries -allConfigurations /p:PackageToBuild=System.Drawing.Common and then the allConfigurations leg, knows what to build only to build a single package and then build that package.
The current way you can achieve that is by disabling BuildPackages
As @safern say, all we need in order to build a package is to restore the targetting packs, and build the ref assemblies, so that is why what @safern is suggesting above is to comment out all of the build of the implementation since you only really care about one single library. The only other optimization you can do, is to also set
nope :). IIRC the only native shim we package is for System.IO.Ports and I believe that this is a separate package entirely. BuildNative will only build clrcompression, and that guy only gets packaged on Microsoft.NETCore.App, so library OOB packages shouldn't need it.
You can build individual pkgprojs, assuming all ref and redist are available (as mentioned above). This will get easier once we stop relying on the ref and redist pass for non-netcoreappcurrent.
WRT dotnet pack we could tackle that with dotnet/arcade#1033, along with eliminating pkgroj and making our packages build from outer build of our src projects.
An ugly hack would be to have a Pack target defined in our src csprojs that just calls build on the pkgproj if it exists.
Also just to update the instructions @safern and I provided above some time ago, there have been changes in the infrastructure so those are no longer up-to-date, but the good news is that it is much easier now to build one single package without the need to modify temporarily any source files. So if you are in master branch latest, and in a clean clone, all you have to do is to first build all targetting packs with:
That shouldn't take long (takes about 3-5 mins on my machine depending on NuGet restore). After that you should be able to build all configurations for a specific library, like for example:
cd src\libraries\System.DirectoryServices.Protocols\
dotnet build src\System.DirectoryServices.Protocols.csproj /t:rebuild /p:BuildAllConfigurations=true
and finally you should also now be able to build the package itself, by running:
As long as you are only working with one library and don't really care about running tests (as running tests will require building the whole clr and libs runtime) then I recommend this workflow as a fast-paced way to be able to open library solutions in VS and have all building as expected as well as being able to build all configurations and the package (if building an OOB assembly)
That shouldn't take long (takes about 3-5 mins on my machine depending on NuGet restore). After that you should be able to build all configurations for a specific library, like for example:
I think this step shouldn't be necessary right? as building the pkgproj will build the ref and src for all configurations?
The thing I've seen is that if you use the workflow I proposed above, building the pkgproj won't call restore on the ref and src projects, which we now need to do, so it is just a way to make sure restore is called (notice how I used dotnet build and not dotnet msbuild since I wanted restore to happen)
Activity
safern commentedon Feb 13, 2020
What we could do is introduce a property like
PackageToBuildso that you dobuild.cmd -subsetCategory libraries -allConfigurations /p:PackageToBuild=System.Drawing.Commonand then the allConfigurations leg, knows what to build only to build a single package and then build that package.The current way you can achieve that is by disabling
BuildPackagesruntime/src/libraries/build.proj
Line 8 in c0e876f
and commenting the following:
runtime/src/libraries/dirs.proj
Lines 13 to 16 in d5adc6b
Then you can afterwards just build the pkgproj of interest, but that is a lot of steps, introducing a property that does it for you would be ideal.
cc: @ericstj @joperezr
joperezr commentedon Feb 13, 2020
As @safern say, all we need in order to build a package is to restore the targetting packs, and build the ref assemblies, so that is why what @safern is suggesting above is to comment out all of the build of the implementation since you only really care about one single library. The only other optimization you can do, is to also set
runtime/src/libraries/build.proj
Line 6 in 48080fa
to false since you don't really need to build native in order to build packages and that will save you quite some additional time.
safern commentedon Feb 13, 2020
Well, some packages need to build the native stuff, no?
joperezr commentedon Feb 13, 2020
nope :). IIRC the only native shim we package is for System.IO.Ports and I believe that this is a separate package entirely. BuildNative will only build clrcompression, and that guy only gets packaged on Microsoft.NETCore.App, so library OOB packages shouldn't need it.
safern commentedon Feb 13, 2020
Right.
Ah, for windows, that's true, I was thinking of Crypto packages, but those shims ship inbox as part of the framework.
ericstj commentedon Feb 24, 2020
You can build individual pkgprojs, assuming all ref and redist are available (as mentioned above). This will get easier once we stop relying on the ref and redist pass for non-netcoreappcurrent.
krwq commentedon Apr 30, 2020
would be nice if we made
dotnet packwork in our repo (even if targets are hacked and it's actually not using dotnet utils)ericstj commentedon Apr 30, 2020
WRT dotnet pack we could tackle that with dotnet/arcade#1033, along with eliminating pkgroj and making our packages build from outer build of our src projects.
An ugly hack would be to have a Pack target defined in our src csprojs that just calls build on the pkgproj if it exists.
joperezr commentedon Apr 30, 2020
Also just to update the instructions @safern and I provided above some time ago, there have been changes in the infrastructure so those are no longer up-to-date, but the good news is that it is much easier now to build one single package without the need to modify temporarily any source files. So if you are in master branch latest, and in a clean clone, all you have to do is to first build all targetting packs with:
That shouldn't take long (takes about 3-5 mins on my machine depending on NuGet restore). After that you should be able to build all configurations for a specific library, like for example:
and finally you should also now be able to build the package itself, by running:
As long as you are only working with one library and don't really care about running tests (as running tests will require building the whole clr and libs runtime) then I recommend this workflow as a fast-paced way to be able to open library solutions in VS and have all building as expected as well as being able to build all configurations and the package (if building an OOB assembly)
safern commentedon Apr 30, 2020
Thanks, @joperezr for updating the instructions.
I think this step shouldn't be necessary right? as building the pkgproj will build the ref and src for all configurations?
ericstj commentedon Apr 30, 2020
joperezr commentedon Apr 30, 2020
The thing I've seen is that if you use the workflow I proposed above, building the pkgproj won't call restore on the ref and src projects, which we now need to do, so it is just a way to make sure restore is called (notice how I used dotnet build and not dotnet msbuild since I wanted restore to happen)
joperezr commentedon Apr 30, 2020
I haven't tried skipping my second step and just doing
dotnet build pkg\System.DirectoryServices.Protocols.pkgprojbut that probably works as well.safern commentedon Apr 30, 2020
Right, that is what I was about to ask 😄.
ViktorHofer commentedon May 1, 2020
FWIW
ViktorHofer commentedon Jul 30, 2020
Fixed (documented) by b7f809d: https://github.com/dotnet/runtime/blob/b7f809d7e37f8dade15fc6aa588565d3f0ee20a6/docs/workflow/building/libraries/README.md#build-packages
TL;DR:
is sufficient now. No allconfigurations build needed anymore.