Appveyor not calling Nuget Pack - nuget-package

On my Appveyor project here I have it configured in the build with Package NuGet projects checked. And in my source code I have a .csproj with a matching .nuspec here but my build isn't calling nuget pack to create the .nupkg file.
What am I missing?

The problem was that I had an incorrect configuration in my appveyor.yml file. I updated the file to be only this and it started working.
version: '2.0.0.{build}-prerelease'
build:
publish_nuget: true

Related

msbuild with p:RunOctoPack missing files

DLLs are missing when I package using MSBuild.
msbuild ./MyProject.vbproj /p:RunOctoPack=true /p:OctoPackEnforceAddingFiles=true
There are no missing files if I use octo pack directly
octo pack --id="testing" --format="zip" --version="3.3.3" --basepath="MyProject\bin\debug"
Both of these commands work on the same folder, and I have verified the files exist in that folder.
The missing files are from the ActivePDF nuget package. The files are created in the bin/debug folder during the build process.
From MS Build:
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET Framework
OctoPack: OctoPack version: 3.6.4.0
For Octo pack directly.
".octopack/octo" version 4.42.2
Msbuild uses an octo nuget package and there is no version 4.x.
My nuspec is trivial:
MyProject
MyProject Title
0.1.0
Dev Team
Me
http://temp.abc
http://temp.abc
false
MyProject

Unable to deploy app with nuget references on server

I am having a hard time deploying my first .net core app with nuget references on the server. Locally, the app works absolutely fine (able to use nuget packages).
Apparently, there is no packages.config. I am using Dapper, Newtonsoft.Json, etc. Where is the project storing reference to these packages? There is no packages folder.
In the solutions folder, there is nuget.config file which for some reason is empty.
What should I add here
Unable to deploy app with nuget references on server
That because you are using the old version nuget restore task in the build pipeline, which only supports for the package management type packages.config not PackageReference.
That the reason why the old version task ask you to provide the path to the packages.config. The PackageReference is a follow-up product, so the previous version of nuget restore task does not support it.
Check the blog for some more details.
To resolve this issue, please use the V2 of the nuget restore task:
Note:
The PackageReference needs the nuget.exe 4.1 and above, please add
a NuGet tool installer to install the nuget version above 4.1.
Using .NET Core restore task should be also work for this issue.
Update:
Yes, using TFS 2016
Since you are using TFS 2016, you could try to use the command line to invoke the nuget.exe to restore the package instead of the nuget installer task:
Download the nuget.exe above 4.0 from the nuget.org, then set it on the TFS server.
Hope this helps.
You need to create a NuGet.config file that points to whatever NuGet feed you're using, add it to source control, and reference it in your build. I'll use the official feed for my example. This feed is already present by default if you're developing using Visual Studio, which might explain why the build runs locally but not on Azure DevOps.
At the very least, your NuGet.config file needs to look like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet.org Feed" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
In .NET Core, packages are now stored globally in your User directory. packages.config has been dropped in favor of the PackageReference node in a project file, so check your csproj to see the NuGets you're referencing.
You should use task dotnetcorecli task which has
#command: 'build' # Options: build, push, pack, publish, restore, run, test, custom

Azure DevOps Build Solution using wrong version of package

I've got a 'Build Solution' step for a ASP.NET project in Azure DevOps and it's failing because it's trying to use an old version of a package. In my code it's only referenced in the packages.config and I've changed that entry to use version 1.0.7, but in Azure DevOps it's still trying to find 1.0.2 but fails to find it. Any ideas why it's trying to use the wrong package version or how to force it to get the new one? My project in visual studio has no references to the old version.
There were references in the .csproj file that were trying to access the old file path, and that version of the package did not exist at that path. So I took the bad path out and it fixed the issue
Probably one of your NuGet packages requires version 1.0.2 of the package. To figure out which one, delete the local version 1.0.2 and build the solution locally. Then take a look at the build output and see which package is missing that version. Maybe take a look here:
Increase Build Log Verbosity to Get More Details About a Build Problem

update or downgrade .csproj file after nuget restore packages from packages.config

I have many VSTS builds which has reference to one nuget package. Depending on primiary build we have to sometimes to upgrade/downgrade nuget package in VSTS build. We are doing this by copying packages.config with proper version, then we use nuget restore. My problem is that after upgrade/downgrade of nuget package .csproj file still have old version od package reference, so when build starts it still try to search for old reference from .csproj file and build fails.
I there any way to change .csproj file after nuget restore?
No, there is no way to update the .csproj during the build. You should change the .csproj locally and then build in VSTS.
Except the way manually changed the .csproj file, there has an easier way to change package versions correspondingly in .csproj. Execute below command in Package Manager Console window:
update-package -reinstall
So the workflow to use upgrade/downgrade nuget package version as below:
Change the versions in package.config file.
Run the command update-package -reinstall in in Package Manager Console window.
Commit and push/checkin the changes to remote repo.
Build your project in VSTS with the upgrade/downgrade nuget package version reference.

Azure websites Deploy from Source Control fails on nuget dependency

Asp.Net v4 Webforms App has a dependency on Windows.Azure.Storage. This all works fine if i use WebDeploy to deploy it to Azure Websites.
Now i want to use a branch in my bitbucket repo to have it auto deploy from source control.
I set up the branch, linked azure to it, and then triggered a deploy.
But it fails, and this is in the Azure log...
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\DWASFiles\Sites\kdb\VirtualDirectory0\site\repository\Pfv.Kdb.UI\Kdb.UI.csproj]
Nuget has package restore enabled, and i checked nuget.targets to ensure that DownloadNugetExe condition is set to true.
Why is it failing to pull in the nuget dependencies?
I have just tried out creating a MVC4 app in VS2012 referencing Windows.Azure.Storage nuget package and succesfuuly pushed it from local git to windows azure without any issues.
I did not hit this issue. I have enabled nuget package restore and also included a .gitignore in to my git repo not to push binary and package files.
I also saw this with pushing the repo to WAWS.
remote: Successfully installed 'WindowsAzure.Storage 2.0.5.1'.

Resources