I have an error in Visual Studio 17.5.1. My Visual Studio is up to date.
The error
The license file "LICENSE.md" does not exists in the package. NuGet Error NU5030
My project file (.csproj)
The files are located in a parent folder. SolutionFolder/ProjectFolder
I tried
<None Include="../LICENSE.md" Pack="true" Visible="true" PackagePath="" />
<None Include="../LICENSE.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="LICENSE.md" Pack="true" Visible="true" PackagePath="" />
or
<None Include="LICENSE.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="$(MSBuildThisFileDirectory)LICENSE.md" Pack="true" PackagePath="" />
<None Include="$(SolutionDir)LICENSE.md" Pack="true" PackagePath="" />
Project.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>net6.0</TargetFramework>
<PackageId>$(AssemblyName)</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseFile>License.md</PackageLicenseFile>
<IncludeContentInPack>false</IncludeContentInPack>
<VersionPrefix>27.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Version>27.0.0</Version>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Include="License.md" Pack="true" PackagePath="" />
</ItemGroup>
</Project>
Screenshots
Change IncludeContentInPack = true
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>net6.0</TargetFramework>
<PackageId>$(AssemblyName)</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseFile>License.md</PackageLicenseFile>
<IncludeContentInPack>true</IncludeContentInPack>
<VersionPrefix>27.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Version>27.0.0</Version>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Include="License.md">
<Pack>true</Pack>
<PackagePath></PackagePath>
<Visible>True</Visible>
</None>
</ItemGroup>
</Project>
All 5 forms specified on this question works fine, after changing IncludeContentInPack = true.
IncludeContentInPack = false, ignores to add any content when pack operation is executed. If content is not added, the license file does not exists in the nuget package(NuGet Error NU5030).