How to configure vcpkg for multi project solution - visual-studio-2019

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

Related

setup NSIS build in Bamboo

I have to setup build process in Bamboo server. My requirements are,
We have a web-server application [more than 20 web projects, 10 windows service projects, DB scripts, some supported utilities like exe, xml's, code signing certificates, ssl certificates]
We have already build automation in c#, which uses NSIS scripts to generate installer.exe
Our build process has the following steps:
Checkout the source code
Checkout the Utilities
Checkout the NSIS installer source code
Update the source code
Update the Utilities
Update the Product versions in all the Assembly files of all the projects & Wix files
Build all the MSI projects based from the list [Project.xml] -> Once build completed with Code Signing post build CMD, then move to
some [ex: LatestPackage] folder in any [ex: Package] directory
Build all the Web app projects from the list [Project.xml] -> Publish into some [ex: LatestPackage] folder in any [ex: Package]
directory
Build all the support projects for installer from the list [Project.xml]
Copy the "LatestPackage" from "Package" directory to "LatestPackage" folder in "NSIS Installer" directory
Update the Installer source codes
Copy the installer custom assets to respective folder in "Installer" directory [SQL, some exe's]
Update Installer.xml file with the Branding information's in "Installer" directory
Compile Installer.nsi file & Installer package will be generated under Installer directory
Could anyone guide me in right path to achieve this.
1. Need to setup task for each and every projects?
2. Where to keep the files once build completed?
3. How to move the all the projects binaries into another projects directory?
4. How to keep the supported files and copy them to our source code folders?
5. How to maintain the generated build?
Is Bamboo Server Windows based? Can Visual Studio be installed on it?
If yes then you can automate building NSIS installers using MSBuild and Visual & Installer.
Also (if VS is present) there is an option to create NSIS project in Visual Studio and build the installer from it (building the solution from command line).

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.

How to deploy Nuget package '.nupkg' to IIS

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.

VisualStudio 2013 list all NuGet packages

I have a mvc 5 web project with a number of NuGet packages installed (like email, log, pagedlist etc).
In a new similar project I would like to install the same NuGet packages. How can I in the old project list all installed NuGet packages?
You can find a packages.config file in the old project's root directory.
You can copy it to the new project.
If you go to Tools -> NuGet Packet Manager -> Packet manager settings and check Allow NuGet to download missing packages and the other check box that states Automatically check for missing packages during build in Visual Studio it will download it for you next time you build.
If you want to list all installed nuget packages for the project take a look at this one.
http://blogs.msdn.com/b/david_kidder/archive/2014/08/19/micro-blog-how-to-list-installed-nuget-packages-from-package-manager-console-and-be-able-to-read-them.aspx
You might also want to enable nuget package restore to restore the packages when rebuilding your project/s.
Here's another link for you - http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html
In the root folder of your original project find a packages.config file. Copy its contents to your new project, same file name.
Go to Visual Studio > Tools > Package Manager Settings > General
Enable "Allow Nuget to download..." and "Automatically check for missing..."
Now build your new project
Most of the answers here are partially correct.
The first part is true. The packages.config file lists all packages that are used by the project.
However, all the answers about using Package Restore are incorrect. Package Restore will download any missing packages, however it is NOT the same as installing a package into a project. It will not add references, run any install.ps1 scripts, or add files, modify .config, etc. Package Restore simply downloads missing packages. It is assumed that the packages were already installed to the project.
In order for the packages to be correctly installed in your new project, open the Package Manager console, then type:
Update-Package -ProjectName MyProjectName -Reinstall
This will force NuGet to run through the install process and correctly install the package into your project.

Referenced Dll's not found in Team Foundation Service (or: nuget packages not available on other pc)

when I create a build for the Team Foundation Service, I get all kind of reference dll's not found exceptions.
These references are added by nugget packages.
I've added the 'package restore' option on the solution which added 3 files in a .NuGet folder.
EDIT
When i got the solution from TFS on another pc, i got the same errors (missing dll's), so it's not only the TFS build service having problems.
The missing dll's are are missing files from installed nuget packages (some are part of the default VS template, Unity was a package i added later), which (the packages) are added on the first pc, but then are missing on the next pc (that's why i added the 'or' in the title of this question)
How can i get the Nuget added files on pc2 too?
I guess you've found a solution by now. I write this just to provide an answer for this question.
To have NuGet packages automatically downloaded on another PC, you need to enable NuGet package restore on build. You do this in two steps:
Right click the solution and select Enable NuGet Package Restore.
This will add a .nuget solution folder with NuGet.Config, NuGet.exe and NuGet.targets underneath it. These files should actually be checked in to source control, but the binary file is tiny. It will also modify the MSBuild scripts in all projects of the solution to import the NuGet.targets file to hook NuGet into the build process.
In Tools -> Library Package Manager -> Package Manager Settings make sure the option 'Allow NuGet to download missing packages during build' is checked.
This step must be done on all machines.
Now the BuildDependsOn property of all project build scripts should make the RestorePackages target in NuGet.targets kick in and download missing packages before you get build errors for missing references.

Resources