Skip to content

Development Builds

Jahav edited this page Oct 27, 2022 · 4 revisions

ClosedXML uses CI for the develop branch and every PR. The CI compiles the branch, runs tests and generates nuget packages for the branch.

How to test a development build

In order to test a nuget dev builds, we have to overcome few obstacles: The main problem with NuGet packages is that they are cached, even development ones (see https://github.com/NuGet/Home/issues/6579).

1. Create a local NuGet source

NuGet downloads First, we must create a local nuget source. NuGet uses a list of sources to restore a package.

Use CLI

If you are on Linux or just like CLI, add a new source

PS C:\> dotnet nuget add source C:\Temp\nuget-packages\ --name ClosedXml.Local
Package source with Name: ClosedXml.Local added successfully.

You can look through your sources to check if they are in correct order or if they are enabeld or disabled.

PS C:\> dotnet nuget list source
Registered Sources:

  1. nuget.org [Enabled]
    https://api.nuget.org/v3/index.json
  2. Microsoft Visual Studio Offline Packages [Disabled]
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
  3. ClosedXml.Local [Enabled]
    C:\Temp\nuget-packages\

Check that the the local source is enabled

Fundamental principal of NuGet is that package should be same for a specific version in each source, therefore the order of sources is not significant.

Use VS

In the Visual Studio, got to Visual Studio Tools -> Options -> NuGet Package Manager -> Package Sources

2. Copy dev package to the local source

Go to the AppVeyor CI to the Artifacts tab and download the nuget package to the local NuGet source. You can download from the PR or the unstable develop branch at https://ci.appveyor.com/project/ClosedXML/ClosedXML/branch/develop/artifacts.

image

image

3. Clear cached files

NuGet caches all retrieved files (either from local sources or from some web) in the local cache. When a project asks to restore a package, nuget first looks into the cache to check if the requested version has already been retrieved. This behavior is good for normal usage, but can be problematic for development builds that have a same version (e.g. 0.97.1-preview), but are built from different commits.

Go to the local cache directory (should be in the user home directory under .nuget/packages), in the closedxml directory remove the version you want to restore from the local source. image

4. Restore a dev package in a test project

Add a dependency on your preview verion to the PackageReference of your csproj file

Either modify the csproj file

    <!-- A reference to a preview package 0.97.1-preview downloaded from the AppVeryor CI -->
    <PackageReference Include="ClosedXML" Version="0.97.1-preview" />

or use dotnet tool

PS C:\Temp\DemoProj> dotnet add package ClosedXML -v 0.97.1-preview
Determining projects to restore...

And done, just build and everything should work to test out the dev build:

  • nuget will check the cache if a package with specificed version is already there
  • nothing will be found in the cache, because we deleted it.
  • nuget will try to check sources for the dev package.
  • nuget won't find anything in the offical relase source (e.g. nuget.org)
  • nuget will find the package in the required version in the local source for CLosedXML
  • nuget will copy the dev package to the cache and to the project (along with dependencies and other stuff).

You can check that the ClosedXML is the correct one by probing the CloseXML.dll in the bin folder. Either optn the dll in a dotPeek tool or by looking at the properties of the dll (the upper is a build number from AppVeyor):

image

FAQ

Examples

Real world scenarios

Time Savers

Performance and Memory

Misc

Inserting Data/Tables

Styles

Ranges

Rows

Columns

Page Setup (Print Options)

AutoFilters

Comments

Dev docs

Clone this wiki locally