How to deploy Nuget package '.nupkg' to IIS - jenkins

we are using NuGet command line( https://www.nuget.org/downloads ) to create deploy-able NuGet package (.nupkg).
The project is in .net framework 4.6, project is build using MSBuild & created the deployment package using Nuget.exe . We need to deploy the NuGet package(.nupkg) in IIS(Internet Information Services) on windows platform.
Tried to web-search but didn't worked out. need open-source tools or mannual automated step by step process to do so.
please guide.

What do you mean by "deploy the NuGet package(.nupkg) in IIS(Internet Information Services)"?
Anyway nupkg is just an archive so you can simply get dlls out of it with and use them where you need.

Related

How to configure vcpkg for multi project solution

I am seeking advice on how to proper configure a multi project solution in relation to third party c++ libraries added with vcpkg.
How do you checkout a specific version of a library for a project?
How do you configure Visual Studio 2019 to use this version for debug and release (lib, dll, headers)?
How do I share the configuration with other developers and build servers?
Here is how I did it:
fork vcpkg repo to local repository (TFS Git in my case)
make a project-specific branch (project being internal company project, not Visual Studio project)
pile on my own port modifications
add few scripts that build a package containing only libraries aforementioned project needs (nuget on windows, 7zip for Linux), see vcpkg export command
label with package version (e.g. 1.0.0.2)
build and deploy to a share (that is properly backed up)
configure some IIS instance in company network to serve packages from aforementioned share
in Visual Studio related projects refer to nuget package
on Linux related cmake script pulls correct version of package using http GET, unpacks it and imports vcpkg cmake file
every time a change needs to be made to the package:
modify your vcpkg branch, label with next version and push
build new package version (filename should contain version)
deploy package to that share
update your cmake files and/or nuget config files
I also tried to export only 1 library (cpprestsdk) but instead vcpkg just exported everything it had installed! Can't it just export the dependent libs only?
vcpkg export cpprestsdk:x64-windows --zip

How to configure older version of package with packages available on TFS server

I have a VS 2008 file that runs on my computer perfectly fine and does everything it needs to do. When I update the TFS version of it its copies exactly, just as you'd expect. However when I build my solution on TFS it can't find a package in my packages folder in my project folder.
This all makes sense, the .gitignore has it set so that packages in the project are removed (unless necessary), and my company uses nuget to deal with all common 3rd party packages used. That being said, how do I get a reference to the package (with appropriate version) from the TFS server to my code on TFS?
P.S. This is my first time dealing with this tech so apologies if the lingo is being misused. Thanks!
How to configure older version of package with packages available on TFS server
If you are using the TFS version is 2015 or above, there is NuGet Installer or NuGet Restore task, which you could use to restore the nuget package from the package source to the work directory when you build your project:
Check the document Azure Artifacts and NuGet restore Vs NuGet installer.
If you are using the TFS version is 2013 and below, you can
check the document Integrate NuGet Package Restore TFS Build 2013 or Older to restore nuget packages.
Hope this helps.

Nuget Restore in MS Build Step

In my asp.net web application, i have solution with 5 projects and nuget.org. In TFS Build Definition,
1) While building the whole solution in Visual Studio Build Task
Nuget packages getting restored.
2) While trying to generate executable files for individual projects in MS Build Task
If I select Restore Nuget packages, It's not finding nuget packages and step getting failed with message - "Process 'NuGet.exe' exited with code '1'."
I have tried many references online and none worked. Any suggestions on how to solve this?
Do i need to make any changes in the nuget.config file to support restoring
packages to individual projects.
Do not directly select Restore Nuget pacakges in MS build task configuration. This option is deprecated. To restore NuGet packages, add a NuGet Installer step before the build.
(Important) This option is deprecated. Make sure to clear this
checkbox and instead use the NuGet Installer build step.
Source Link: MSBuild
Besides, you could also build single project not the entire solution in Visual Studio Build task. Just select the project (.*proj) files instead of .sln file.
Unless you are building a customized MSBuild project file, then we recommend you use the MSBuild step instead of the Visual Studio Build step.
You could also try to build single project using Visual Studio Build task, see if the issue is still exists.
Same problem, downgraded to 4.4.1. it helped

Packaging nuget package on VSTS 'Newtonsoft.Json' already has a dependency defined for 'NETStandard.Library'

Packaging a build use Nuget Packager in VSTS and i get the error:
[error]'Newtonsoft.Json' already has a dependency defined for 'NETStandard.Library'.
Most of the hints that solves this involves updating nuget, but since I am building on Team Services I can't really do this.
It seems that the nuget used by nuget packager is not the latest. After testing locally with latest nuget.exe everything worked so I added a new powershell release step. This solution is appropriate for VSTS, for TFS where you have access to the server I recommend upgrading nuget.exe on the server itself:
This script downloads nuget.exe into the artifacts directory (and outputs the path to the nuget.exe so you can see where it is put.).
I then altered the Nuget Packager build step to use the freshly downloaded nuget.exe.
Had the same issue today.
Using your own build agent
If you are using your own build agents (rather than the hosted agent) you can manually update the version of NuGet to the latest version. In my case, this has resolved my problems.
e.g. C:\agent\externals\nuget\nuget.exe
Using the hosted agent
It's a bit messy but you could just upload the latest nuget.exe into the repo and set the NuGet Packager to use this.
To anyone getting this in 2018, Microsoft have created a new version of the NuGet task that fixes this issue. No need for powershell install steps.
Change the NuGet task version in your build step version to 2.*
This caused some breaking changes for me, that I resolved with the following advanced settings
Nuget Restore
Nuget Pack
Nuget push

How do I install the Entity Framework on my build server?

How do I install the Entity Framework on my build server? I only have MS Visual Studio Shell installed there and there is no Package Manager Console.
Thanks.
Do one of the following
Add the EF assemblies to source control so they can be downloaded on checkout
Enable nuget package restore and allow the build server access to the internet to download the packages.
You don't need to install EntityFramework on your build server. EntityFramework is part of the BCL, so all you have to do is install .NET on your build server. Now if you need to use some extensions that are available through NuGet packages, all you need to do is to add reference to those packages in your project and then all the necessary assemblies will be part of the web application. Thus the web application is self-contained. All you have to do is to put them under source control so that the build server is able to retrieve them.

Resources