I am setting up a continuous integration of my nuget packgae on VSTS, I am following the steps mentioned here https://learn.microsoft.com/en-us/vsts/build-release/tasks/package/nuget to have build number as nuget version.
I am using 2.* of nuget pack with automatic package Versioning set to use the build number and build number format under options set to $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r).
But this does not effect my version it always comes to be same 2.0.1
I am unable to understand what additional task has to be done.
The build number has been updated by GitVersionTask. So, disable it by specifying UpdateAssemblyInfo to false.
<PropertyGroup>
...
<UpdateAssemblyInfo>false</UpdateAssemblyInfo>
...
</PropertyGroup>
Article: GitVersionTask Conditional control tasks.
If you don’t need to update the version, you can uninstall GitVersionTask package.
Related
I have Visual Studio solution with 10 .net core 3.1 library projects (let's call them CORE). One of them is a main project. It has references to other projects.
I want to have one nuget package (stored in azure feed) which I can use in my other solutions because I won't add all dlls every time when I need CORE functionality. I need to define Azure Pipeline to do that job. How to define that pipeline which produce one package containing all other references (dlls)?
When you build the NuGet package, you can provide -IncludeReferencedProjects switch to the nuget pack command, and the referenced projects will be added as part of the package:
nuget pack MyProject.csproj -IncludeReferencedProjects
Note, that according to the docs:
If a referenced project includes a .nuspec file of its own, then NuGet adds that referenced project as a dependency instead. You need to package and publish that project separately.
I would suggest you get acquainted with this article. There are more options to granularly control the contents of your package. The raw nuget commands that are referenced there map easily to the appropriate CI tasks.
Is it possible in azure DevOps to trigger a build on a project which uses a Nuget when the Nuget is updated?
Say I have a Nuget called DataAccessorNuget and two projects called DataConsumerA and DataConsumerB. If I make a commit in DataAccessorNuget I want this to automatically publish an updated nuget, and then trigger a build in DataConsumerA and B. In that build I want to update to latest version of DataAccessorNuget, build the DataConsumer and then run whatever tests I have.
Currently I have to so that DataAccessorNuget creates the new Nuget, but I am unsure how to trigger the build in DataConsumer. I see that I can configure DataConsumers pipeline to trigger on builds in an other repository, but ideally I would like this process to be configured automatically so I don’t need to update the build pipeline if I install a new nuget. Also, a change in the repo where the nuget lives does not mean that the nuget has been changed.
Trigger a build on a project which uses a Nuget when the Nuget is updated
You can try to use the Build completion trigger on the Trigger tab for the build pipelines of project DataConsumerA and DataConsumerB, like:
After add the build pipelines of project DataAccessorNuget, then when we use the build task DataAccessorNuget create a new NuGet package, after build completed, the build pipelines of project DataConsumerA and DataConsumerB will be triggered. So that we do not need update the build pipeline manually if you have a new nuget.
Hope this helps.
Our small, distributed team uses a NuGet package in a project. That package has a bug in the current release. Unfortunately the package does not publish debug symbols and source, so I grabbed & built the latest source, removed the project via NuGet and added a (temporary) reference to the project I just built locally.
Turns out, the issue is fixed in the latest code base.
This particular project only seems to release updates on NuGet every 6 months or so.
Until that next release, our team needs to use the code version where the bug is fixed.
One option certainly is to check the source code into our source code repository and keep the project reference (rather than a NuGet reference), essentially treating it as an internal utility project.
That feels "old school" though.
Is there a better way to manage this situation, using the NuGet infrastructure?
One option is to create your own NuGet package with the updated code. Then add a new Local Package source (just create a file share and place the .nupkg file there). Move the local package source up higher in priority than the official one so NuGet will use your package before looking online.
In fact I recommend copying all NuGet packages to a local repository, especially if you use package restore. This way you are not dependent on nuget.org to be up all the time (there have been several instances of downtime).
The one drawback is that when an updated package is finally published to nuget.org, Update-Package will not pick up the new one unless you specify the package source.
Anyway this will allow you to continue to use NuGet while waiting for your updated package.
We're building a set of several services, each service has it's own solution with associated projects. Many of these services rely on the same NuGet packages.
All the solutions have "Package Restore" enabled.
Some of the solutions refer to assemblies owned by other solutions, this is one obvious reason why we need all the solutions to refer to exactly the same versions of different NuGet Packages.
All of the services need to work together to achieve an end result. They're packaged and installed as part of a single product, which is another reason we'd like everything to be running off the same versions of the NuGet Packages
We're having trouble keeping package versions consistent between Solutions.
Currently we're manually checking and updating package versions, we're also getting occasional compilation errors because projects in one solution end up referring to different versions of the same package.
Is there a recommended way of doing this (hopefully an automatic process)?
Would we be better off without Package Restore?
Anyone have any general advice on the subject?
Thanks
Update: I created an issue for this on the NugGet project http://nuget.codeplex.com/workitem/2623
To solve this:
Create your own private NuGet server (see 1 and 2) that hosts the correct versions of the packages you use.
Configure each build system to use that server and auto update to the latest version.
Although this requires a server, it not only ensures everyone has the correct version but speeds up the downloads for build servers as well.
You could configure your TFS builds to update all NuGet packages in the solution to their latest versions using the nuget update command.
The latest versions could be from nuget.org, a local NuGet server or even a network share. Use the source parameter to define the sources you want to update from.
You can perform the build configuration via MsBuild proj files or via a TFS template.
I was just upgrading my project from sdk 1.3 to 1.7 and I noticed that now when I build the application the package(cspkg) is not created with the build. I have go click on publish to create a package. Is there a way to tell VS to create a package everytime a build is triggered.
Also using msbuild is there a way to do the same thing. I have multiple projects under a solution, Most of which are just libraries and then there is this azure app. Is there a way to specify a single msbuild statement with params to tell the azure app to create the package as well as build the other projects. Also when I specify debug the debug package should be created and when I specify release switch the release package should be created.
How could I do the same thing on my build server as well where I have a .proj file which specifies the sln to build. How could I mention a switch to build the package there.
Thanks,
Kunal
You can configure CSPACK command (Be sure to have CSPACK.exe launched from SDK 1.7 Path otherwise you will get some schema related errors with SDK 1.6 project) as Post Build event in your Windows Azure Application Build settings. This way when you will build, after successful build CSPACK command will run and package your application. Same way you can configure your MSBuild configuration. I just tested and it worked for me.
Visit this MSDN article on packaging a cloud service to learn more.
You can do this using msbuild as well. See the Resolution section of this question.