[HOWTO] PowerShell NuGet package creation with JetBrains TeamCity
Hi, this is Marc Rufer from d-fens GmbH. I started working at d-fens as a Software Engineer this week. I already wrote some posts and I’ll continue sharing information about […]
Audit and Consulting of Information Systems and Business Processes
Hi, this is Marc Rufer from d-fens GmbH. I started working at d-fens as a Software Engineer this week. I already wrote some posts and I’ll continue sharing information about […]
Hi, this is Marc Rufer from d-fens GmbH. I started working at d-fens as a Software Engineer this week. I already wrote some posts and I’ll continue sharing information about my work on this blog.
In todays blog post I’ll explain step by step how to set up a build configuration for a PowerShell-Project on a JetBrains TeamCity 9 server.
The build configuration will be responsible to create a NuGet-package out of the PowerShell scripts. To show the build configuraiton I used the PS.System.Utilities project, which is available on GitHub, as sample.
Prerequisites
Step by step manual
1. Log in to your TeamCity server and go to the Administration board
2. Click Create project from URL
3. Select the parent project, enter the repository URL and the repository credentials
4. Define the project and build config names
5. Next, TeamCity will scan the source code and try to auto detect some build steps
6. Choose the desired build steps out of the recommendations
7. To adjust the build step click on edit in the row of the build step
8. [OPTIONAL] Create a build trigger (for more details see Trigger build on commit to VCS)
9. Now the build configuration is ready to run
The distribution of the NuGet package to a NuGet repository can be directly integrated into the build process. To integrate the distribution into the build process you have to perfrom the following steps.
The following message appeared in the build log.
[push] Failed to process request. ‘The specified API key is invalid or does not have permission to access the specified package.’.
The API key was valid, so I searched for the reason of the problem and found a discussion on stackoverflow with the answer to the problem. The same message appears in the build log if the package already exists on the nuget repository.
The TeamCity Free Open Source License was generously provided by JetBrains