How to include current package version in NuGet transformation files? - nuget

I would like to include a content file into the package that should refer to the current version of the package being installed (more precisely to the package folder, but the only varying part is the version).
Is there a special syntax (e.g. $packageversion$ - does not work) to include the version number into a transformed (.pp) content file?
Alternative: I can access the version from the install.ps1 and I can also invoke Add-Content (i suppose that will also apply the transformations), but how can I extend the replacement placeholders?

The variables you can use (like $rootnamespace$) are the ProjectProperties so you won't be able to access the version number.
As a workaround, you could try naming the file as part of your build step that creates the NuGet package.
If you think it'd be good to see this added to NuGet, it's worth starting a discussion on the NuGet site, the developers are pretty active there :-)

Related

How to install multiple versions of a compatible package in CentOS with YUM

Is there a way to install multiple versions of the same package in CentOS/RHEL (7/8) if the package installs separate files in each version?
We have an application we've recently converted to using RPM instead of a home-built package manager based on tar. In order to make atomic-like switches between versions, each version installed in separate directories with the version number in the name, and a symlink with the unversioned name pointed to the current, or previous, version at any given moment in time. The application, of course, used the unversioned name to get init script, configuration files, interpreter version and code. I'm thinking that the alternatives package would be the basis for this, although we wouldn't use the alternatives command to manage symlinks (although there's no technical reason not to).
Not exactly as you describe.
Some packages allow this (Kernel and Kernel-devel being two of them) but i beilieve this is an exception added within the package manager.
Certain Applications like PHP and Python which is perfectly acceptable to have multiple version (Python2.X and 3.X) do this by changing the base name of the application/rpm.
Take a look at: https://rpm.org/user_doc/multiple_versions.html
It gives a good insight on how to achieve what you want

Using Cake (C# Make) to always get latest NuGet package version

Is it possible to use Cake to always get the latest version of a specific NuGet package? I know NuGet itself only allows you to set that at the base Nuget.config level. There are some internal packages that we would like to always get the latest version of (some of our database entities), while other internal packages we don't want to force a latest (our extensions package, for example). Right now we have to go through and manually update projects that rely on those packages, and I would like to automate those "always get latest" at build.
I don't see anything using any of the NuGet add-ins, but I am new to Cake so I'm hoping I am just missing something.
Has anyone had any luck using Cake to always retrieve the latest version on the feed for specific named packages, and just use the current packages.config version for the rest?
The short answer is that you can do anything that you want.
Cake out of the box will attempt to adopt established best principles for reproducible builds.
With the preprocessor directive, you could simply omit the version information, and Cake/NuGet will fetch the latest version. However, once downloaded to the tools folder, Cake/NuGet will not fetch it again. What you could do is add a custom step in your bootstrapper to clear the tools folder each time before build, and then the latest version will be downloaded each time.
Note: This is NOT a recommended approach, but rather something custom for your setup.

Why are some NuGet packages named with nuget-bot?

I went to add a NuGet package for Microsoft.TeamFoundationTracking.Client and in the list of available packages I have the options:
Microsoft.TeamFoundation.WorkItemTracking.Client
and
nuget-bot.Microsoft.TeamFoundation.WorkItemTracking.Client
The one with nuget-bot has a higher version number than the one without it. I don't ever recall seeing packages with the nuget-bot in the name. I assume there is some convention or format that this refers to.
Thanks for any explanation of what this means.
I'm not familiar with the nuget-bot packages, but if you are looking for official Microsoft binaries, you will want to look for those where the Owner is set to Microsoft (not just the author). The package you seek is most likely: Microsoft.TeamFoundationServer.ExtendedClient

How can I dynamically create files for a Perl distribution without manifest tests or makefiles complaining?

I'm creating a Perl 5 module distribution, the source of which is hosted on github. I've run into the same problem as user Anirvan in this question: I'd like github to see a README.md file, but the .tar.gz to include the same file as plain README. The answer to that question, "use README.pod for both", works in this case, but I'm wondering if I could have made my original attempt work:
I only have README.md in the repository, not README.
My MANIFEST contains README (since that's going into the tarball), but not README.md (since it isn't).
My MANIFEST.SKIP contains README.md, since I don't want that in the tarball.
My Makefile.PL (*) has an entry under PL_FILES to a short script that copies the README.md to a README file
This generates the README, but along the way:
t/manifest.t without make complains that README is in the manifest, but is missing
perl Makefile.PL also complains about README missing
Am I misinterpreting the purpose of the MANIFEST file, or this test? Is it somehow possible to denote a file which should be packed, but isn't there yet? I've tried changing the test, but I could only find a way for Test::CheckManifest to ignore files that were there, but "shouldn't be", not ignore files that are not there, but "should".
(*) Yes, I'm using ExtUtils::MakeMaker, since that's what module-starter defaulted to, and it works so far. I'm not sure if another tool would change much, though.
(Answering my own question here): ExtUtils::MakeMaker, Module::Build and the others are primarily installation methods. You should ignore what make, Build and the others are complaining about while building the distribution. It's what make disttest complains about that matters.
For that matter, do not place code to help build your distribution in Makefile.PL. You should only place code there that is to be run during installation time. So if you want README.md to become README, you had better distribute README.md too. This is obviously not what you want(*).
Instead, take a look at Dist::Zilla. This is explicitly a distribution creation system, and not an installation system.
(*) Replying to your own question can get really wierd… :-/

Good practice to make the .exe and .dll have the same version?

For a new release I increase the version number of the executable, should I make all the dll have the same version number as the executable even if the dll is not updated at all?
Keeping the DLL version #'s the same make it easier to verify that a customer has a consistent install. To achieve this, in MSVC++ You can include the version numbers in a header file that is included into the .rc file so that you only need define the version # in one place. You probably don't want to include the build # (the 4th number in the version) in this so that you can patch DLL's individually. I put the build # in a per-DLL header file to do this.
Only recommended if your product is bundled as single package like .msi or .cab file. Otherwise it will make your partial updates too heavy as that will require all the binaries to be updated even if they are not required to.