Color scheme: Dark
You are here: start » en » Documentation » Microsoft Access development tools » WKL Office SDK » WKL Office SDK how-to guides » How to: Build an Access application with dotnet build

How to: Build an Access application with dotnet build

Build the database with dotnet build - on a developer machine, in CI, or from an IDE - with the same result as wkl-office build.

Solution overview

The project file is MSBuild XML. Importing the targets of the SDK at its end gives it the targets Build, Rebuild, Clean, Check, Validate, Export and Roundtrip; the MSBuild tasks behind them call the same classes as wkl-office.

CommandDoes what wkl-office does with
dotnet build Customers.acprojbuild (-p:WklAccessAccde=true or false for --accde / --no-accde)
dotnet build Customers.acproj -t:Rebuildrebuild
dotnet build Customers.acproj -t:Cleanremoves build/<configuration>; takes no project lock, so do not run it while another run works on the project
dotnet msbuild Customers.acproj -t:Check, -t:Validate, -t:Export, -t:Roundtripcheck, validate, export, roundtrip; -t:Export -p:WklAccessDatabaseToExport=<file> exports another database, as -d

Implementation

Add the import as the last element of Customers.acproj:

  <Import Project="<folder of Wkl.Office.Sdk.MSBuild>\Wkl.Office.Sdk.targets" />
</Project>
dotnet build Customers.acproj -p:Configuration=Release

Remarks

  • Every problem becomes an MSBuild error or warning with its file and line and the code WKL + the number of its phase (WKL001 sources, WKL900 a difference found by the roundtrip), so editors and CI logs show it at its place.
  • While another run works on the same project (wkl-office in a terminal, the Access add-in), a task fails at once with error WKL010 naming that run (The project is busy).
  • A file another program holds open (an editor, a virus scanner) fails the task with error WKL011 naming the file and the program (A file is in use by another program).
  • Canceling the build (Ctrl+C, Stop in an IDE) asks the hidden Access of the running step to close and ends it after 30 seconds; no Access stays behind.
  • The tasks need the MSBuild of the .NET SDK (dotnet build). msbuild.exe of Visual Studio runs on the .NET Framework and cannot load them.

What is reproducible

The same sources, built with the same SDK version, the same Access (version and bitness), the same registered references, the same ANSI code page and the same template and control blocks, give a database with the same objects, tables, data and settings, and its export writes the same sources. The database file is not byte-identical between two builds: Access gives every object loaded from text a new GUID and stores compiled code and time stamps. Pin these inputs on build machines; the project file names no SDK version. Every dotnet build builds the whole database again; the targets are not incremental. CI needs an interactive Windows session with Access (see Install the SDK).

en/wiki/msaccess/sdk/how-to/build-with-dotnet-build.txt · Last modified: by Wolfgang van der Stille