title: Files of build folder in self-published package not consumed by third-party projects
body: <p>Having a problem publishing a package with only build utilities. Being precise: I followed the <a href="https://docs.microsoft.com/en-au/nuget/create-packages/creating-a-package#include-msbuild-props-and-targets-in-a-package" rel="nofollow noreferrer">nuget guideline</a> which files have to be where. So I created a simple [project][2] in which I just want deploy the <code>.props</code> and <code>.targets</code> files in the build folder for third-party projects. When I pack it with <code>dotnet pack Teronis.Packaging.ProjectBuildInPackage.csproj --configuration Release)</code> the .nupkg file does contain all necessary files:</p>
  
  <pre><code>Listing archive: bin\Release\Teronis.Packaging.ProjectBuildInPackage.1.0.0.nupkg
  
  --
  Path = bin\Release\Teronis.Packaging.ProjectBuildInPackage.1.0.0.nupkg
  Type = zip
  Physical Size = 3027
  
     Date      Time    Attr         Size   Compressed  Name
  ------------------- ----- ------------ ------------  ------------------------
  2020-01-11 18:13:12 .....          533          297  _rels\.rels
  2020-01-11 18:13:12 .....          696          358  Teronis.Packaging.ProjectBuildInPackage.nuspec
  2020-01-11 17:03:22 .....          435          208  build\Teronis.Packaging.ProjectBuildInPackage.props
  2020-01-11 11:28:08 .....         1188          532  build\Teronis.Packaging.ProjectBuildInPackage.targets
  2020-01-11 18:13:12 .....          534          219  [Content_Types].xml
  2020-01-11 18:13:12 .....          735          413  package\services\metadata\core-properties\3bab4543af344c95ae6210e86f61f55a.psmdcp
  ------------------- ----- ------------ ------------  ------------------------
  2020-01-11 18:13:12               4121         2027  6 files
  </code></pre>
  
  <p>When I add this package (<code>nuget add bin/Release/Teronis.Packaging.ProjectBuildInPackage.1.0.0.nupkg -Source "C:\Users\&lt;user&gt;\.nuget\packages"</code>) to my local feed, after I have deleted it of course, and let a sample project with customized feed sources include that specific package, the generated <code>obj/project.assets.json</code> will not contain the <code>.props</code> and <code>.targets</code> files it should:</p>
  
  <pre><code>{
    "version": 3,
    "targets": {
      ".NETStandard,Version=v2.0": {
        "Microsoft.NETCore.Platforms/1.1.0": {
          ...
        },
        "NETStandard.Library/2.0.3": {
          ...
        },
        // ###############################################
        "Teronis.Packaging.ProjectBuildInPackage/1.0.0": {
          "type": "package"
          // Here should the .props and .targets files be referenced
        },
        "Test.Localization/1.0.0": {
          ...
        }
      }
    },
    "libraries": {
      "Microsoft.NETCore.Platforms/1.1.0": {
        ...
      },
      "NETStandard.Library/2.0.3": {
        ...
      },
      // ###############################################
      "Teronis.Packaging.ProjectBuildInPackage/1.0.0": {
        "sha512": "vKfduDW8+hIYQ1s6zFO0EnCmJTSVGAzsvcDDM2YIEiIqksGX1WO/ERMvAkXmJR2Q0x92wFk+z0i448HuYmUWSQ==",
        "type": "package",
        "path": "teronis.packaging.projectbuildinpackage/1.0.0",
        "files": [
          ".nupkg.metadata",
          // Here are the .props and .targets files missing
          "teronis.packaging.projectbuildinpackage.1.0.0.nupkg.sha512",
          "teronis.packaging.projectbuildinpackage.nuspec"
        ]
      },
      "Test.Localization/1.0.0": {
        "type": "project",
        "path": "../../Teronis.DotNet/src/Packaging/ProjectBuildInPackage/test/Test.Localization/Test.Localization.csproj",
        "msbuildProject": "../../Teronis.DotNet/src/Packaging/ProjectBuildInPackage/test/Test.Localization/Test.Localization.csproj"
      }
    },
    "projectFileDependencyGroups": {
      ...
    },
    "packageFolders": {
      "C:\\Users\\&lt;user&gt;\\.nuget\\packages\\": {},
      "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {}
    },
    "project": {
      "version": "2.0.0",
      "restore": {
        "projectUniqueName": "C:\\Users\\&lt;user&gt;\\source\\repos\\Teronis.Packaging.ProjectBuildInPackage.Test\\Teronis.Packaging.ProjectBuildInPackage.Test\\Teronis.Packaging.ProjectBuildInPackage.Test.csproj",
        "projectName": "Teronis.Packaging.ProjectBuildInPackage.Test",
        "projectPath": "C:\\Users\\&lt;user&gt;\\source\\repos\\Teronis.Packaging.ProjectBuildInPackage.Test\\Teronis.Packaging.ProjectBuildInPackage.Test\\Teronis.Packaging.ProjectBuildInPackage.Test.csproj",
        "packagesPath": "C:\\Users\\&lt;user&gt;\\.nuget\\packages\\",
        "outputPath": "C:\\Users\\&lt;user&gt;\\source\\repos\\Teronis.Packaging.ProjectBuildInPackage.Test\\Teronis.Packaging.ProjectBuildInPackage.Test\\obj\\",
        "projectStyle": "PackageReference",
        "fallbackFolders": [
          "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
        ],
        "configFilePaths": [
          "C:\\Users\\&lt;user&gt;\\source\\repos\\Teronis.Packaging.ProjectBuildInPackage.Test\\NuGet.Config",
          "C:\\Users\\&lt;user&gt;\\AppData\\Roaming\\NuGet\\NuGet.Config",
          "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
        ],
        "originalTargetFrameworks": [
          "netstandard2.0"
        ],
        "sources": {
          "C:\\Users\\&lt;user&gt;\\.nuget\\packages": {},
          "https://api.nuget.org/v3/index.json": {}
        },
        "frameworks": {
          "netstandard2.0": {
            "projectReferences": {
              "C:\\Users\\&lt;user&gt;\\source\\repos\\Teronis.DotNet\\src\\Packaging\\ProjectBuildInPackage\\test\\Test.Localization\\Test.Localization.csproj": {
                "projectPath": "C:\\Users\\&lt;user&gt;\\source\\repos\\Teronis.DotNet\\src\\Packaging\\ProjectBuildInPackage\\test\\Test.Localization\\Test.Localization.csproj"
              }
            }
          }
        },
        "warningProperties": {
          "warnAsError": [
            "NU1605"
          ]
        }
      },
      "frameworks": {
        "netstandard2.0": {
          "dependencies": {
            "NETStandard.Library": {
              "suppressParent": "All",
              "target": "Package",
              "version": "[2.0.3, )",
              "autoReferenced": true
            },
            "Teronis.Packaging.ProjectBuildInPackage": {
              "include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
              "suppressParent": "All",
              "target": "Package",
              "version": "[1.0.0, )"
            }
          },
          "imports": [
            "net461",
            "net462",
            "net47",
            "net471",
            "net472",
            "net48"
          ],
          "assetTargetFallback": true,
          "warn": true,
          "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.100\\RuntimeIdentifierGraph.json"
        }
      }
    }
  }
  </code></pre>
  
  <p>The package in a sample project is referenced as</p>
  
  <pre><code>  &lt;ItemGroup&gt;
      &lt;PackageReference Include="Teronis.Packaging.ProjectBuildInPackage" Version="1.0.0"&gt;
        &lt;PrivateAssets&gt;all&lt;/PrivateAssets&gt;
        &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;/IncludeAssets&gt;
      &lt;/PackageReference&gt;
    &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>So it should include the build assets. I think it has something to do with the supported frameworks as this package should be supported for every framework/"framework" like <code>netcore</code>, <code>netcoreapp</code>, <code>net</code>, <code>netstandard</code>, and so on.</p>
  
  <p>It should be said, that when creating the package the nuget analyzer does complain about</p>
  
  <pre><code>1&gt;------ Build started: Project: Teronis.Packaging.ProjectBuildInPackage, Configuration: Release Any CPU ------
  1&gt;Teronis.Packaging.ProjectBuildInPackage -&gt; C:\Users\&lt;user&gt;\source\repos\Teronis.Packaging.ProjectBuildInPackage\Teronis.Packaging.ProjectBuildInPackage\bin\Release\netstandard2.0\Teronis.Packaging.ProjectBuildInPackage.dll
  1&gt;Successfully created package 'C:\Users\&lt;user&gt;\source\repos\Teronis.Packaging.ProjectBuildInPackage\Teronis.Packaging.ProjectBuildInPackage\bin\Release\Teronis.Packaging.ProjectBuildInPackage.1.0.0.nupkg'.
  1&gt;C:\Program Files\dotnet\sdk\3.1.100\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): warning NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:
  1&gt;C:\Program Files\dotnet\sdk\3.1.100\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): warning NU5128: - Add lib or ref assemblies for the netstandard2.0 target framework
  1&gt;Done building project "Teronis.Packaging.ProjectBuildInPackage.csproj".
  ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>Even when I know how to fix it by just creating <code>lib/netstandard2.0/_._</code> it does not solve my problem, that the <code>.props</code> and <code>.targets</code> files are not taken up by the nuget target that creates <code>obj/project.assets.json</code> intermediately.</p>