Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7939409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:05:25+00:00 2026-06-03T23:05:25+00:00

I would like to build Nuget package for my add-on which will be used

  • 0

I would like to build Nuget package for my add-on which will be used by end user to install as startup task and after that they will upload their applications on window azure platform.

Let’s take one simple web application and one cloud project now using Nuget end user will added add-on package it will add 2 files(exe & config) in web application project & add startup task to ServiceDefinition.csdef of cloud project as per shown in figure

enter image description here

How can i created this type of Nuget Pacakge?

Thanks in advance.

Update:

I have tried according with NICK’s answer however i am getting problem with 2 webrole in cloud project according to shown in below fig.
Cloud project with 2 webrole
and error i am getting as per below

error to add startup task with powershell script

Also i have one question that If i am installing that Nuget package with command line then how i can consider all webrole projects to add exe and config file in solution??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:05:26+00:00Added an answer on June 3, 2026 at 11:05 pm

    Nuget packages work based on a convention:
    http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#From_a_convention_based_working_directory

    As far as the exe and config you can do the following:

    1. In your package directory make the following directories
      • mkdir lib (for the exe)
      • mkdir content (for the config)

    All you have to do for the exe is drop the file in the lib directory and modify you .nuspec file just under the metadata node. There should be a “files” node (if not you can add one). Add something like this inside the files node:

    <file src="content\my.exe" target="content\my.exe" />
    

    The config is a little different. Just add a file named myname.config.transform to the content directory and add an entry into the .nuspec file:

    A couple of things to note:

    1. If the config file does not exist in your app it will add one for you.
    2. You only have to add the nodes you want transformed if there is a file that already exists
    3. The transform file will do a complete match on your node so if the following existed in

    your config file:

    <add key="test" value="myval"/>
    

    And in your transform you had:

    <add key="test" value="myval2"/>
    

    The resulting file would look like:

    <add key="test" value="myval"/>
    <add key="test" value="myval2"/>
    

    As far as adding the startup task, that’s been a little more tricky for me (there might be a much better way). I use powershell in the install.ps1 (just like the files above but you create a “tools” directory for it):

    param($installPath, $toolsPath, $package, $project)
    
    #Modify the service config - adding a new Startup task
    $svcConfigFile = $DTE.Solution.Projects|Select-Object -Expand ProjectItems|Where-Object{$_.Name -eq 'ServiceDefinition.csdef'}
    $ServiceDefinitionConfig = $svcConfigFile.Properties.Item("FullPath").Value
    [xml] $xml = gc $ServiceDefinitionConfig
    
    #Create startup and task nodes
    
    # So that you dont get the blank ns in your node
    $startupNode = $xml.CreateElement('Startup','http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition')
    $taskNode = $xml.CreateElement('Task','http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition')
    $taskNode.SetAttribute('commandLine','my.exe')
    $taskNode.SetAttribute('executionContext','elevated')
    $taskNode.SetAttribute('taskType','simple')
    $startupNode.AppendChild($taskNode)
    
    #Check to see if the startup node exists
    $modified = $xml.ServiceDefinition.WebRole.StartUp
    if($modified -eq $null){
        $modified = $xml.ServiceDefinition.WebRole
        $modified.PrependChild($startupNode)
    }
    else{
        $nodeExists = $false
        foreach ($i in $xml.ServiceDefinition.WebRole.Startup.Task){
            if ($i.commandLine -eq 'my.exe'){
                $nodeExists = $true
            }
        }
        if($taskNode -eq $null -and !$nodeExists){
            $modified.AppendChild($taskNode)
        }
    }
    $xml.Save($ServiceDefinitionConfig);
    

    I hope this helps out.

    –Nick

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand how to build dll nuget package I would like to build a
I would like to build a app which will provide current location using cellular
I would like to build a cypher with python which decoding text by repeatedly
I would like to build a query that will pull the number of rows
I would like to build some code which calls some code on loadup of
I would like to build a general matrix module, which includes such general operations
I would like to build a website where user can post on of their
I would like to build an iOS whitelabel application which should be customizable to
I would like to build an iPhone app that will back up phone data
I would like to build an application that will run on a web, this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.