Skip to content

Commit 595f91f

Browse files
authored
Merge pull request #154 from eerhardt/UpdateDevGuide
Update DEVGUIDE for local testing
2 parents da83f2f + c55b77c commit 595f91f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

DEVGUIDE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,27 @@ Then, you can use `dotnet add package Microsoft.NET.Build.Containers -prerelease
1515

1616
You can also always clone this repository, run `dotnet build`, and use the newly-generated nupkg.
1717

18+
To use your locally built packages:
19+
20+
* Add a local nuget source:
21+
* `dotnet nuget add source C:\temp\packages -n local`
22+
* Build the repo and note where the .nupkg is outputted:
23+
* `dotnet build -c Release`
24+
* ...
25+
* `Successfully created package 'C:\git\sdk-container-builds\Microsoft.NET.Build.Containers\bin\Release\Microsoft.NET.Build.Containers.0.2.0-alpha.14.gda83f2fee0.nupkg'.`
26+
* Push the generated package to the local source:
27+
* `dotnet nuget push C:\git\sdk-container-builds\Microsoft.NET.Build.Containers\bin\Release\Microsoft.NET.Build.Containers.0.2.0-alpha.14.gda83f2fee0.nupkg -s local`
28+
* In a test project, add the local package:
29+
* `dotnet add package Microsoft.NET.Build.Containers --version 0.2.0-alpha.14.gda83f2fee0`
30+
* Publish the test project with `-p:PublishProfile=DefaultContainer` to create a container for your application:
31+
* `dotnet publish -c Release --os linux --arch x64 -p:PublishProfile=DefaultContainer`
32+
* Run your test app to ensure it works
33+
* `docker run -it --rm -p 5010:80 myapp:1.0.0`
34+
35+
**NOTE**: Rebuilding and restoring local NuGet packages may cause versioning conflicts due to NuGet caching earlier iterations with the same version number. Be sure to delete the `microsoft.net.build.containers` folder in the NuGet cache in between building and restoring new changes to this repo. For example:
36+
* `rmdir -Force -Recurse ~\.nuget\packages\microsoft.net.build.containers`
37+
* `rm -rf ~/.nuget/packages/microsoft.net.build.containers`
38+
1839
## References
1940

2041
* [OCI Image Format spec](https://github.com/opencontainers/image-spec/blob/main/spec.md)

0 commit comments

Comments
 (0)