0

I need to create a Nuget of project A which is dependent on project B (not a nuget project, local one).

I have added Project B as project dependency to project A and enabled property to generate package on build. It is creating nuget package file but not including all the files from project A. I tried few things and google also but not finding much help.

I found one similar question Build NuGet Package automatically including referenced dependencies but not working. I am able to create pkg but with few files copied over. while I can see all the files in debug folder. No idea on what basis Nuget is picking few files from project A.

Can anyone tell me what's wrong here.

<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <PackageVersion>1.0.0.0-alpha</PackageVersion>
    <Platforms>x64</Platforms>
    <TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <PlatformTarget>x64</PlatformTarget>
    <NoWarn></NoWarn>
    <WarningsAsErrors />
    <OutputPath>bin\Debug</OutputPath>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <PlatformTarget>x64</PlatformTarget>
    <NoWarn></NoWarn>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <WarningsAsErrors />
    <OutputPath>bin\Release</OutputPath>
  </PropertyGroup>

  <ItemGroup>
    <Reference Include="System.Configuration" />
  </ItemGroup>

  <ItemGroup>

    <ProjectReference Include="someProject.csproj">
      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
     <IncludeAssets>all</IncludeAssets>
    </ProjectReference>
  </ItemGroup>

  <Target DependsOnTargets="ResolveReferences" Name="CopyProjectReferencesToPackage">
    <ItemGroup>
      <BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))"/>
    </ItemGroup>
  </Target>

</Project>
Abhash786
  • 881
  • 2
  • 24
  • 53

0 Answers0