OctoPack - turning on and off easily?

mikejdriver's Avatar

mikejdriver

07 Dec, 2017 10:04 AM

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:
<PropertyGroup>
    <RunOctoPack>true</RunOctoPack>
    <OctoPackPublishPackageToHttp>http://xx.xx.xxx.xxx/nuget/packages?replace=true</OctoPackPublishPackageToHttp>
    <OctoPackPublishApiKey>API-ABCDEF</OctoPackPublishApiKey>
  </PropertyGroup>
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

  1. 1 Posted by mikejdriver on 07 Dec, 2017 11:16 AM

    mikejdriver's Avatar

    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

  2. Support Staff 2 Posted by Dalmiro Grañas on 07 Dec, 2017 04:41 PM

    Dalmiro Grañas's Avatar

    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

  3. Support Staff 3 Posted by Dalmiro Grañas on 07 Dec, 2017 04:44 PM

    Dalmiro Grañas's Avatar

    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

  4. 4 Posted by mikejdriver on 12 Dec, 2017 03:43 PM

    mikejdriver's Avatar

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

  5. Support Staff 5 Posted by Dalmiro Grañas on 12 Dec, 2017 03:56 PM

    Dalmiro Grañas's Avatar

    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

  6. 6 Posted by mikejdriver on 12 Dec, 2017 04:32 PM

    mikejdriver's Avatar

    OK thanks you thats clearer now :-)
    Mike

  7. mikejdriver closed this discussion on 12 Dec, 2017 04:32 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac