Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Copy file from NuGet package to OutDir in a project not working on Azure DevOps

$
0
0

I have an issue on Azure DevOps only!

It works fine in Visual Studio 2019, when I right click and Build.It also works fine if I use dotnet build from a CMD, locally.

Nuget package looks like this:

csproj

<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><ItemGroup><None Update="Utilities.Api.xml"><CopyToOutputDirectory>Always</CopyToOutputDirectory></None></ItemGroup>

props file

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

When I run the pipeline on Azure I use this version of MSBuild (Microsoft (R) Build Engine version (16.7.0+7fb82e5b2 for .NET) via "dotnet build".

pipeline build step:

  - task: DotNetCoreCLI@2    displayName: Build    timeoutInMinutes: 0    inputs:      command: build      projects: src/**/*.csproj      arguments: '--configuration $(BuildConfiguration) /p:reportanalyzer=true /p:TreatWarningsAsErros=$(warnAsErrors)'

I have a publish step after my build.

 - task: DotNetCoreCLI@2    condition: and(succeeded(), not(variables.RunSonar))    displayName: Publish and zip artifacts    inputs:      command: publish      publishWebProjects: false      arguments: '--configuration $(buildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)'      packDirectory: '$(Build.ArtifactStagingDirectory)'      zipAfterPublish: true      projects: |        src/**/*.Api.csproj        !src/Test/**/*.csproj

This is beginning to be super frustrating :)


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>