OctoPack - turning on and off easily?

Hi,
I’m using OctoPack in Visual Studio for one of our projects.
I have OctoPack installed and have set the required lines in the csproj file setting:

true
http://xx.xx.xxx.xxx/nuget/packages?replace=true
API-ABCDEF

All is working well.
However, the build time goes from 10 seconds to a couple of minutes when pushing the .nupkg file created to the Octopus manager server. Which is fine when you want to build and release. But is there an easy way of turning it off during coding stages as you can imagine multiple builds are done, many fact, before we want to push the package.
Yes i can edit the csproj file but that seems a bit crude.
So is there an easier way to switch from from true to false and vice versa within visual studio?
Many thanks
Mike

Hi,
In VS
Right click on project and unload,
Right click on project and edit the csproj file
Right click and reload the project
OK this is not too bad if the csproj is checked in with false for octopack run.
My mistake just getting familiar with the ins and outs of this.
Mike

Hi Mike,

Thanks for reaching out!

I would only recommend you to hardcode those entries in the csproj file if you want to run Octopack every-single-time you build, which doesn’t seem to be your case. If you are only going to use Octopack when you actually want release a new version, I’d recommend you to remove those csproj entries and pass them to MSBuild as parameters only when you are about to release a version.

msbuild MySolution.sln /t:Build /p:RunOctoPack=true /p:OctoPackPublishPackageToHttp=http://xx.xx.xxx.xxx/nuget/packages?replace=true /p:OctoPackPublishApiKey=API-ABCDEFG

Dalmiro

or you could have these 2 hardcoded in the csproj:

<PropertyGroup>     
    <OctoPackPublishPackageToHttp>http://xx.xx.xxx.xxx/nuget/packages?replace=true</OctoPackPublishPackageToHttp> 
    <OctoPackPublishApiKey>API-ABCDEF</OctoPackPublishApiKey> 
  </PropertyGroup> 

And then pass /p:RunOctoPack=true when you do want to run Octopack

Hi,
We build through visual studio; how would I issue that command to msbuild - from where?

Hi,

Building trough Visual Studio is only recommended for Dev builds really. When it comes to building your binaries for Production, its always recommended to use a Build Server which will issue an MSBuild command in the background.

Since you are not using a build server, you should run that command yourself from Powershell or from the Developer Command prompt for Visual Studio. The command would look like this:

msbuild MySolution.sln /t:Build /p:RunOctoPack=true

Note how we are not passing OctoPackPublishPackageToHttp or OctoPackPublishApiKey. That’s because those 2 are being passed in the csproj.

Regards,
Dalmiro

OK thanks you thats clearer now :slight_smile:
Mike