dotnet restore does not copy files to outdir on azure devops, works in vs

140 views Asked by At

I have a nuget packages with a props file:

<Project>

    <Target Name="CopyFilesToProject" BeforeTargets="Build">
        <ItemGroup>
            <SourceScripts Include="$(MSBuildThisFileDirectory)..\File\*.xml*"/> 
        </ItemGroup>
        <Copy
           SourceFiles="@(SourceScripts)"
           DestinationFolder="$(OutDir)"
        />
    </Target>


</Project>

And in the nuget csproj file it has

  <ItemGroup>
    <None Include="Utilities.Api.xml" Pack="true" PackagePath="File">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Include="build\Utilities.Api.props" Pack="true" PackagePath="build"></None>

  </ItemGroup>

This copies the xml file to the OutDir, and it works fine within visual studio, when I build.

When I use the dotnet restore in my pipeline:

  - task: DotNetCoreCLI@2
    displayName: Restore
    inputs:
      command: restore
      projects: src/**/*.csproj
      verbosityRestore: Minimal
      vstsFeed: 'foobar-nugets'

It does not copy the xml file for the csproj's that has a reference to that nuget package.

Am I missing something ?

0

There are 0 answers