Skip to content

OData .NET Template: An ASP.NET Core template for creating .NET projects with OData support.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
License.txt
Notifications You must be signed in to change notification settings

OData/ODataDotNetTemplate

Repository files navigation

ASP.NET Core OData Web API Template


Component Build Status
ASP.NET Core ODataDotNetTemplate Rolling Build Status
ASP.NET Core ODataDotNetTemplate Nightly Build Status

This repository provides a .NET template for creating an ASP.NET Core Web API project with OData support. It supports configurations for .NET 8.0 and above, with appropriate setups for each version.

Prerequisites

Getting Started

Follow these steps to use the template locally:

1. Clone the Repository

git clone https://github.com/OData/AspNetCoreODataDotNetTemplate.git

2. Project Build and Content Generation

This project uses MSBuild to automate the build process and generate content from templates. Below are key files involved in this process.

Files

  • Directory.Build.targets: tools/Directory.Build.targets contains custom MSBuild targets applied to all projects in the directory and its subdirectories. Also contains targets for managing version information.
  • Directory.Build.props: Directory.Build.props contains common properties applied to all projects in the directory and its subdirectories.

3. Build Repo

Navigate to the cloned repository directory and build the project to restore necessary packages and dependencies:

cd <repository-directory>/AspNetCoreODataDotNetTemplate/sln
dotnet build

4. Use build.cmd/build.ps1 Script

At the root, there is a PowerShell script (build.ps1) that automates building, creating NuGet packages, and testing the AspNetCoreOData template project.

Usage

To run the script, open a PowerShell terminal, navigate to the directory containing the build.cmd file, and execute the script with the -help parameter:

build.cmd -help

Examples

  1. Build the solution with default settings:
.\build.cmd
  1. Build the solution in Debug configuration and run tests with detailed verbosity:
.\build.cmd -SolutionPath ".\sln\MySolution.sln" -c "Debug" -Test -v "Detailed"
  1. Build the solution and create NuGet packages:
.\build.cmd -SolutionPath ".\sln\MySolution.sln"
  1. Running tests:
.\build.cmd -Test

Artifacts

Building this repo produces artifacts in the following structure:

artifacts/
  bin/                 = Compiled binaries and executables
  obj/                 = Intermediate object files and build logs
  log/
    *.log            = Log files for test runs and individual tests
  $(Configuration)/
    *.binlog         = Binary logs for most build phases
  packages/
  $(Configuration)/
    *.nupkg        = NuGet packages for nuget.org

IncrementVersion.ps1

This script increments the version number in the specified msbuild props file. The version number can be incremented in the following ways:

  • Major version increment
  • Minor version increment
  • Revision version increment
  • Version release number increment

Parameters

  • versionPath: The path to the msbuild props file where the version number is specified.
  • lastReleaseCommit: The ID of the last commit to be released.
  • forceMajorIncrement: Whether to force an increment of the major version number.
  • versionRelease: The version number to be released. For example, preview, beta, alpha, etc.
  • forceMinorIncrement: Whether to force an increment of the minor version number.
  • Help: Show help.

Examples

Increment the minor version number in the Directory.Build.targets file:

Template Project Structure

The generated project will have the following structure:

ODataWebApiApplication/
├── Controllers/
│   └── CustomersController.cs
├── Models/
│   └── Customer.cs
│   └── Order.cs
├── Properties/
│   └── launchSettings.json
├── EdmModelBuilder.cs
├── ODataWebApiApplication.csproj
├── ODataWebApiApplication.http
├── Program.cs
└── appsettings.Development.json
└── appsettings.json

Code of Conduct

This project has adopted the .NET Foundation Contributor Covenant Code of Conduct. For more information see the Code of Conduct FAQ.

.NET Foundation

This project is supported by the .NET Foundation.

ODataDotNetTemplate is a Copyright of © .NET Foundation and other contributors. It is licensed under MIT License

About

OData .NET Template: An ASP.NET Core template for creating .NET projects with OData support.

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
License.txt

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published