Msbuild v15 can't resolve the variables of metadata of nuspec file

前端 未结 1 1434
长发绾君心
长发绾君心 2021-01-05 01:58

I know Since the release of msbuild 15 (vs 2017) that NuGet is now fully integrated into MSBuild.

I have a nuspec file with defining variables of package properties

相关标签:
1条回答
  • 2021-01-05 02:38

    As has been mentioned in the comments, you no longer need a Nuspec file as most aspects can be controlled via properties in the csproj file or additional metadata on items (e.g. if you need additional content).

    If you do need a nuspec file for some reason, you need to provide the variables for substitution yourself. You can do this in a target inside the csproj file like this:

    <Target Name="SetNuspecProperties" BeforeTargets="GenerateNuspec">
      <PropertyGroup>
        <NuspecProperties>$(NuspecProperties);id=$(AssemblyName)</NuspecProperties>
        <NuspecProperties>$(NuspecProperties);config=$(Configuration)</NuspecProperties>
        <NuspecProperties>$(NuspecProperties);version=$(PackageVersion)</NuspecProperties>
        <NuspecProperties>$(NuspecProperties);description=$(Description)</NuspecProperties>
        <NuspecProperties>$(NuspecProperties);authors=$(Authors)</NuspecProperties>
      </PropertyGroup>
    </Target>
    
    0 讨论(0)
提交回复
热议问题