I have a Visual Studio project, that's set up in TeamCity with a build-task to create artifacts via OctoPack (3.0.43). Next, a deploy-task, that receives the output NuGet-package from the build-task task (on successful build) as a dependency.
I've tried setting up the build-task using both the MsBuild
build-runner and the Visual Studio (sln)
one, but in both cases no artifacts are created.
I've added the OctoPack NuGet package to my Visual Studio project.
Found this one out myself:
When I added OctoPack NuGet package, all seemed well. Hinted by various posts, I looked to the OctoPack.targets
file. Here I stumbled upon the Install.ps1
file, that seemed to be supposed to inject some build-actions in the VS project's .csproj file upon adding the NuGet package to project.
Next up, I removed the NuGet package and tried re-installing, but this time using the Package Management Console (View > Other Windows > Package Management Console
) with command:
Install-Package OctoPack
This output the following:
Successfully added 'OctoPack 3.0.43' to MySolution.MyProject. & : File C:\somepath\mysolution\packages\OctoPack.3.0.43\tools\Install.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:3
So, some security stuff was preventing the PowerShell script to do its stuff with the .csproj file.
Solution:
In the same window (Package Management Console) or in an elevated PowerShell, execute
Set-ExecutionPolicy RemoteSigned
Retry NuGet package-installation (still same window or using the NuGet GUI) - now the NuGet package installer should inject whatever your version of OctoPack wants it to. After this, my TeamCity build started generating OctoPack artifacts correctly.