Skip to content

The MSBuild project SDK is used to make sure the PackageReference is used instead of packages.config.

License

Notifications You must be signed in to change notification settings

vchistov/msbuild-sdk-nopackagesconfig

Repository files navigation

Build.NoPackagesConfig

NuGet NuGet

The MSBuild project SDK is used to make sure the PackageReference is used instead of packages.config.

Purpose

The repository may content a lot of projects and solutions. You want to make sure all projects are used PackageReference format to manage NuGet dependencies, e.g. to use restore via MSBuild or manage NuGet dependencies in one place, etc.

The Build.NoPackagesConfig SDK is pretty simple. If a project includes packages.config file it fails the build.

How to use

The best choose is add Import directive into Directory.Build.targets. It allows you import the SDK`s targets into all existing project files under scope of the Directory.Build.targets.

Directory.Build.targets

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="Sdk.targets" Sdk="Build.NoPackagesConfig" Version="1.0.0" />
</Project>

If you want to skip checking for a particular project you may add SkipPackagesConfigUsageChecking property to the project.

SampleProject.csproj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  ...
  <PropertyGroup>
    <SkipPackagesConfigUsageChecking>true</SkipPackagesConfigUsageChecking>
  </PropertyGroup>
  ...
</Project>

About

The MSBuild project SDK is used to make sure the PackageReference is used instead of packages.config.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published