Restore NuGet Package in TeamCity Build and Deploy Step - msbuild

My Build and Deploy step in TeamCity is not successfully executed.
It is showing
"This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props."
Below is the step process log:
[Step 1/1] WebApplication2.sln.teamcity: Build target: TeamCity_Generated_Build
[22:31:54][WebApplication2.sln.teamcity] TeamCity_Generated_Build
[22:31:54][TeamCity_Generated_Build] MSBuild
[22:31:54][MSBuild] WebApplication2.sln: Build default targets
[22:31:54][WebApplication2.sln] ValidateSolutionConfiguration
[22:31:54][ValidateSolutionConfiguration] Building solution configuration "Debug|Any CPU".
[22:31:54][WebApplication2.sln] Build
[22:31:54][Build] MSBuild
[22:31:54][MSBuild] WebApplication2\WebApplication2.csproj: Build default targets
[22:31:54][WebApplication2\WebApplication2.csproj] EnsureNuGetPackageBuildImports
[22:31:54][EnsureNuGetPackageBuildImports] Error
[22:31:54][Error] R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2\WebApplication2.csproj(282, 5): This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props.
[22:31:54][Step 1/1] MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead.
[22:31:54][Step 1/1] Process exited with code 1
[22:31:54][Step 1/1] MSBuild output
[22:31:54][MSBuild output] Start MSBuild...
[22:31:54][MSBuild output] 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe' '"#R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln.teamcity.msbuild.tcargs" R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln.teamcity'
[22:31:54][MSBuild output] working dir = 'R:\teamcity\buildAgent\work\5cfc9181ba33f9ec'
[22:31:54][MSBuild output] Microsoft (R) Build Engine version 4.7.2046.0
[22:31:54][MSBuild output] [Microsoft .NET Framework, version 4.0.30319.42000]
[22:31:54][MSBuild output] Copyright (C) Microsoft Corporation. All rights reserved.
[22:31:54][MSBuild output]
[22:31:54][MSBuild output] Build started 14/08/2017 10:31:54 PM.
[22:31:54][MSBuild output] Project "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln.teamcity" on node 1 (TeamCity_Generated_Build target(s)).
[22:31:54][MSBuild output] Project "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln.teamcity" (1) is building "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln" (2) on node 1 (default targets).
[22:31:54][MSBuild output] ValidateSolutionConfiguration:
[22:31:54][MSBuild output] Building solution configuration "Debug|Any CPU".
[22:31:54][MSBuild output] Project "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln" (2) is building "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2\WebApplication2.csproj" (3) on node 1 (default targets).
[22:31:54][MSBuild output] R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2\WebApplication2.csproj(282,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props.
[22:31:54][MSBuild output] Done Building Project "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2\WebApplication2.csproj" (default targets) -- FAILED.
[22:31:54][MSBuild output] Done Building Project "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln" (default targets) -- FAILED.
[22:31:54][MSBuild output] Done Building Project "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln.teamcity" (TeamCity_Generated_Build target(s)) -- FAILED.
[22:31:54][MSBuild output]
[22:31:54][MSBuild output] Build FAILED.
[22:31:54][MSBuild output]
[22:31:54][MSBuild output] "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln.teamcity" (TeamCity_Generated_Build target) (1) ->
[22:31:54][MSBuild output] "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2.sln" (default target) (2) ->
[22:31:54][MSBuild output] "R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2\WebApplication2.csproj" (default target) (3) ->
[22:31:54][MSBuild output] (EnsureNuGetPackageBuildImports target) ->
[22:31:54][MSBuild output] R:\teamcity\buildAgent\work\5cfc9181ba33f9ec\WebApplication2\WebApplication2.csproj(282,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props.
[22:31:54][MSBuild output]
[22:31:54][MSBuild output] 0 Warning(s)
[22:31:54][MSBuild output] 1 Error(s)
[22:31:54][MSBuild output]
[22:31:54][MSBuild output] Time Elapsed 00:00:00.19
[22:31:55][Step 1/1] Process exited with code 1
[22:31:54][Step 1/1] Step Build and Deploy (MSBuild) failed
This is what I use in Command line parameter in the step:
/p:Configuration=Debug
/p:DeployOnBuild=true
/p:WebPublishMethod=Package
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:VisualStudioVersion=14.0
/p:PackageLocation="$(build.artifactstagingdirectory)\\"
Let me know if I missed something or not properly coded in the Command line parameter.
Thanks!

First install NuGet.exe in TeamCity Tools.
Then just added another build step before your code compile to restore nuget packages in the project.

You forgot to add the project or solution file.
msbuild .\WebApplication2.sln /p:Configuration=Debug
/p:OutputPath=bin
/p:DeployOnBuild=True
/p:DeployTarget=MSDeployPublish
Or you have to have spaces in your project file names, than you must add quotes around.

Related

MSBuild can't exec command `npm i` while compiling a project in Rider/Visual Studio

I need to build and run a .NET 5 project in Mac using Visual Studio for Mac or Jetbrains Rider.
In csproj file of one of the projects in the solution, I have following Target:
<Target Name="SassBuild" BeforeTargets="Build" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Exec Command="npm i" />
<Exec Command="npm rebuild node-sass" />
<Exec Command="npm run gulp-sass" />
<Exec Command="npm run gulp-js" />
</Target>
When I run dotnet build or dotnet msbuild project builds just fine, however building it in VS/Rider throws the following error:
Error MSB3073: The command "npm i" exited with code 127. (MSB3073)
Details in the log:
Target SassBuild:
npm i
/var/folders/9l/d02_tk1j5f93vklft82p1z996dm09b/T/tmp89785a0aeebb4347a3696de11d8c281e.exec.cmd: line 2: npm: command not found
PATH_TO_CSPROJ_HERE.csproj(232,5): error MSB3073: The command "npm i" exited with code 127.
Done building target "SassBuild" in project "X.csproj" -- FAILED.
npm is installed already and I can run the npm commands in terminal. I use nvm for node versioning.
Any ideas?
Alright, I figured out that Mac OS terminal and VS/Rider terminals are not fed from the same terminal configuration files; that's why the IDEs weren't able to find the npm in their paths.
I copied all the nvm related configuration from ~/.zprofile to ~/.profile and now I am able to build the project in VS/Rider.
Hope it helps anyone having the same problem.

Missing required property 'OutputPath' for project type 'PackageReference'

I'm trying to run the following command thru Jenkins Pipeline
bat 'nuget restore mySolution.sln -MSBuildPath "C:\\Program Files (x86)\\MSBuild\\14.0\\Bin"'
but i'm getting error saying
Invalid restore input. Missing required property 'OutputPath' for
project type 'PackageReference'. Input files: C:\Program Files
(x86)\Jenkins\workspace\My Project Build
Pipeline\myProject\myProject.csproj.
I tried
bat label: '', script: '"C:\\Package tools\\nuget.exe" restore "C:\\Program Files (x86)\\Jenkins\\workspace\\My Project Build Pipeline\\myProject\\myProject.csproj" -MSBuildPath "C:\\Program Files (x86)\\MSBuild\\14.0\\Bin"' // Restore packages.
I'm expecting all the NuGet packages to get installed as we 'Restore NuGet Packages' in Visual Studio.
Apparently you are using VS 2015 tools (MSBuild 14) and/or an older nuget.exe (< 4.0.0) to work on projects using the PackageReference way of referencing NuGet Packages. Use newer tools (Nuget 4+, VS / Build Tools 2017+) to fix this issue.
I fixed this problem by running the powershell command:
Install-Module VSSetup -Scope CurrentUser

how to fix packet mismatching error of dotnet core web api and test api that I refereed with main web api [jenkins]?

I have created dotnetcore webapi along with dotnetcore test unit. I'm using Jenkins pipeline to automate the process but I'm getting error while restoring the packages as shown below.
Started by user admin
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout)
[Pipeline] git
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://github.com/myrepository/dotnetcoreapp # timeout=10
Fetching upstream changes from https://github.com/repository/dotnetcoreapp
> git.exe --version # timeout=10
> git.exe fetch --tags --progress https://github.com/repository/dotnetcoreapp +refs/heads/*:refs/remotes/origin/*
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision e425bdd515356da06b5490fd8e8df4e78b427752 (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f e425bdd515356da06b5490fd8e8df4e78b427752
> git.exe branch -a -v --no-abbrev # timeout=10
> git.exe branch -D master # timeout=10
> git.exe checkout -b master e425bdd515356da06b5490fd8e8df4e78b427752
Commit message: "'hhkhkhk'"
> git.exe rev-list --no-walk cd7d9a6c945b239f6b724a5a3339e051a3efda88 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Restore PACKAGES)
[Pipeline] bat
[jenkins Pipeline] Running batch script
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline>dotnet restore
Restoring packages for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj...
Restoring packages for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj...
Installing Microsoft.Web.Infrastructure 1.0.0.0.
Installing Microsoft.AspNet.WebPages 3.2.6.
Installing Microsoft.AspNet.Razor 3.2.6.
Installing Microsoft.AspNet.Mvc 5.2.6.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\obj\mathcalci.csproj.nuget.g.props.
Restore completed in 20.09 sec for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj.
Installing System.Collections.Specialized 4.0.1.
Installing System.ComponentModel 4.0.1.
Installing System.ComponentModel.Primitives 4.1.0.
Installing System.ComponentModel.TypeConverter 4.1.0.
Installing System.ComponentModel.EventBasedAsync 4.0.11.
Installing System.Diagnostics.TextWriterTraceListener 4.0.0.
Installing Microsoft.TestPlatform.ObjectModel 15.8.0.
Installing xunit.extensibility.core 2.3.1.
Installing xunit.extensibility.execution 2.3.1.
Installing Microsoft.TestPlatform.TestHost 15.8.0.
Installing Microsoft.CodeCoverage 15.8.0.
Installing xunit.core 2.3.1.
Installing xunit.analyzers 0.7.0.
Installing xunit.assert 2.3.1.
Installing Microsoft.NET.Test.Sdk 15.8.0.
Installing xunit 2.3.1.
Installing xunit.runner.visualstudio 2.3.1.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\obj\mathcalcitest.csproj.nuget.g.props.
Restore completed in 33.44 sec for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj.
[Pipeline] echo
packages are restored
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Clean)
[Pipeline] bat
[jenkins Pipeline] Running batch script
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline>dotnet clean
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 10/19/2018 12:56:49 AM.
1>Project "C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln" on node 1 (Clean target(s)).
1>ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
1>Done Building Project "C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln" (Clean target(s)).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.15
[Pipeline] echo
clean is done
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] bat
[jenkins Pipeline] Running batch script
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline>dotnet build --configuration Release
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
Restore completed in 77.74 ms for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj.
Restore completed in 77.74 ms for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
mathcalci -> C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\bin\Release\netcoreapp2.1\mathcalci.dll
mathcalcitest -> C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\bin\Release\netcoreapp2.1\mathcalcitest.dll
Build succeeded.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
16 Warning(s)
0 Error(s)
Time Elapsed 00:00:07.89
[Pipeline] echo
build is done
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Pack)
[Pipeline] bat
[jenkins Pipeline] Running batch script
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline>dotnet pack --no-build --output nupkgs
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
[Pipeline] echo
nupkgs package is created
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Publish)
[Pipeline] bat
[jenkins Pipeline] Running batch script
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline>dotnet publish . -r win-arm
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj...
Restoring packages for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj...
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\obj\mathcalci.csproj.nuget.g.props.
Generating MSBuild file C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\obj\mathcalci.csproj.nuget.g.targets.
Restore completed in 3.3 sec for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci\mathcalci.csproj.
Installing runtime.win-arm.Microsoft.NETCore.DotNetAppHost 2.1.0.
Installing runtime.win-arm.Microsoft.NETCore.DotNetHostResolver 2.1.0.
Installing runtime.win-arm.Microsoft.NETCore.DotNetHostPolicy 2.1.0.
Installing runtime.win-arm.Microsoft.NETCore.App 2.1.0.
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Mvc 5.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.AspNet.WebPages 3.2.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : warning NU1701: Package 'Microsoft.Web.Infrastructure 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : error NU1605: Detected package downgrade: Microsoft.NETCore.App from 2.1.5 to 2.1.0. Reference the package directly from the project to select a different version. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : error NU1605: mathcalcitest -> mathcalci -> Microsoft.NETCore.App (>= 2.1.5) [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : error NU1605: mathcalcitest -> Microsoft.NETCore.App (>= 2.1.0) [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
Restore failed in 39.52 sec for C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj.
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (testing)
Stage "testing" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Publish to git)
Stage "Publish to git" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE
so how can i fix the nuget package mismatching error ? I searched for similar error solution but nothing didn't worked out to me.
This line:
C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalcitest\mathcalcitest.csproj : error NU1605: Detected package downgrade: Microsoft.NETCore.App from 2.1.5 to 2.1.0. Reference the package directly from the project to select a different version. [C:\Program Files (x86)\Jenkins\workspace\jenkins Pipeline\mathcalci.sln]
indicates, that you are using an older package. This downgrade usually failes because other libraries and packages try to refer to the newer versions.
Where is your configuration of what package version you use?
Have you set a version for the Microsoft.NETCore.App Package in a hardcoded way?

CPack - error "Numeric user ID too large"

I'm still new to CMake/CPack tools. This is a short example of my problem with CPack - the real project is much-much bigger. My CMakeLists.txt file is below:
cmake_minimum_required(VERSION 3.9)
project(tm0001)
set(CMAKE_CXX_STANDARD 11)
add_executable(${PROJECT_NAME} tm0001.cpp)
set(CPACK_PACKAGE_CONTACT "HEKTO")
set(CPACK_PACKAGE_VERSION_MAJOR 1)
set(CPACK_PACKAGE_VERSION_MINOR 0)
set(CPACK_PACKAGE_VERSION_PATCH 0)
set(CPACK_GENERATOR "DEB")
include(CPack)
It's not important what is in the tm0001.cpp file - it may be just a simple Hello World program. I'm trying to generate a deb-file for this project but getting an error:
hekto#ubuntu:~/tm0001/build$ make package
Scanning dependencies of target tm0001
[ 50%] Building CXX object CMakeFiles/tm0001.dir/tm0001.cpp.o
[100%] Linking CXX executable tm0001
[100%] Built target tm0001
Run CPack packaging tool...
CPack: Create package using DEB
CPack: Install projects
CPack: - Run preinstall target for: tm0001
CPack: - Install project: tm0001
CPack: Create package
CPack Error: Error creating debian package:
#top level directory: /home/hekto/tm0001/build/_CPack_Packages/Linux/DEB
#file: tm0001-1.0.0-Linux.deb
#error:archive_write_header: Numeric user ID too large
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: tm0001
make: *** [package] Error 1
What's the meaning of this Numeric user ID too large message? Where is it from? How to get rid of it?
(CMake/CPack version is 3.11.3)
This is a now-fixed bug in CMake 3.10 and 3.11. It has been fixed in 3.12. Either use CMake 3.9 or earlier, or CMake 3.12 or later.

AppVeyor Octopack - Failing GetAssemblyVersion

I have a asp.net core 2.0 web app. I am attempting to use AppVeyor to build a nuget package with octopack, so our octopus server can handle our deployment process.
I have the following steps listed in my appveyor.yml file to do the nuget restore, and publish:
before_build:
- cmd: choco install octopustools
- cmd: nuget restore
- cmd: dotnet restore MyApp/MyApp.csproj
- cmd: dotnet publish MyApp/MyApp.csproj --output published-app --configuration=%CONFIGURATION%
- cmd: octo pack --id MyApp --version %APPVEYOR_BUILD_VERSION% --basePath MyApp/published-app
However, when the build reaches the dotnet publish of the site, it fails with the following error:
dotnet publish MyApp/MyApp.csproj --output published-app --configuration=%CONFIGURATION%
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
SendGrid.NetCore -> C:\projects\MyApp\SendGrid.NetCore\bin\Release\netcoreapp2.0\SendGrid.NetCore.dll
MyApp -> C:\projects\MyApp\MyApp\bin\Release\netcoreapp2.0\MyApp.dll
C:\Users\appveyor.nuget\packages\octopack\3.6.3\build\OctoPack.targets(47,5): error MSB4018: The "GetAssemblyVersionInfo" task failed unexpectedly. [C:\projects\MyApp\MyApp\MyApp.csproj]
C:\Users\appveyor.nuget\packages\octopack\3.6.3\build\OctoPack.targets(47,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. [C:\projects\MyApp\MyApp\MyApp.csproj]
C:\Users\appveyor.nuget\packages\octopack\3.6.3\build\OctoPack.targets(47,5): error MSB4018: File name: 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [C:\projects\MyApp\MyApp\MyApp.csproj]
C:\Users\appveyor.nuget\packages\octopack\3.6.3\build\OctoPack.targets(47,5): error MSB4018: at OctoPack.Tasks.GetAssemblyVersionInfo.Execute() [C:\projects\MyApp\MyApp\MyApp.csproj]
C:\Users\appveyor.nuget\packages\octopack\3.6.3\build\OctoPack.targets(47,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\projects\MyApp\MyApp\MyApp.csproj]
C:\Users\appveyor.nuget\packages\octopack\3.6.3\build\OctoPack.targets(47,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [C:\projects\MyApp\MyApp\MyApp.csproj]
C:\Users\appveyor.nuget\packages\octopack\3.6.3\build\OctoPack.targets(47,5): error MSB4018: [C:\projects\MyApp\MyApp\MyApp.csproj]
C:\Users\appveyor.nuget\packages\octopack\3.6.3\build\OctoPack.targets(47,5): error MSB4018: [C:\projects\MyApp\MyApp\MyApp.csproj]
Command exited with code 1
I am unsure why octopack targets would not be found, since I am installing the latest octopustools, and the target should be based upon the referencing project.
UPDATE: I have RDP'd into the build server, and I was able to successfully run the commands from a powershell console, and they were successful. here are the commands, and results of running those commands:
PS C:\projects\MyApp> dotnet publish MyApp/MyApp.csproj --output published-app --configuration=Release
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
SendGrid.NetCore -> C:\projects\MyApp\SendGrid.NetCore\bin\Release\netcoreapp2.0\SendGrid.NetCore.dll
MyApp -> C:\projects\MyApp\MyApp\bin\Release\netcoreapp2.0\MyApp.dll
MyApp -> C:\projects\MyApp\MyApp\published-app\
and here is the octopack step:
PS C:\projects\reportal> octo pack --id Reportal --version 2.2.2.2 --basePath Reportal/published-app
Octopus Deploy Command Line Tool, version 4.27.0
Packing Reportal version "2.2.2.2"...
Saving "Reportal.2.2.2.2.nupkg" to "C:\projects\reportal"...
Done.
*so at this time I am lost why the commands are failing on appveyor runs, but not when I run the same commands when RDP'd into the same machine.
UPDATE #2: I have now realized these commands should have been run as ps (powershell) commands, no standard cmd (bash) commands. I corrected them to
before_build:
- ps: echo buildNumber= $env:appveyor_build_number
- ps: echo configration= $env:configuration
- ps: choco install octopustools
- ps: choco install bower
- ps: nuget restore
- ps: dotnet restore MyApp/MyApp.csproj
- ps: dotnet publish MyApp/MyApp.csproj --output published-app --configuration $env:configuration
- ps: octo pack --id Reportal --version $env:appveyor_build_number --basePath MyApp/published-app
BUT the output still is returning the same error regarding the octopack target shown above. these command are EXACTLY how I am running them from the RDP session, which are building and packaging correctly. So lost on why this auto build fails, but manually running the same commands from the RDP works.
So I got a response from Octopus Deploy that the Octopack nuget package is not been updated to work with .net core projects.
Once I removed the package, the build and package with the octopus tools worked great. here are the full steps that worked for my project:
build_script:
- ps: choco install octopustools --no-progress
- ps: choco install bower --no-progress
- ps: dotnet restore
- ps: dotnet publish MyApp/MyApp.csproj --output published-app --configuration $env:configuration
- ps: octo pack --id MyCompany.MyApp --version $env:appveyor_build_version --basePath MyApp/published-app