none
Azure Pipeline Build RRS feed

  • Question

  • Hi,

    I was unable to copy the .exe (executable) file after build succeeded. My requirement is to copy the source folder to my destination folder (in the local system). I have used the below code

    - task: CopyFiles@2
    inputs:
    SourceFolder: '$(Build.SourcesDirectory)/ConsoleApp1'
    Contents: '**\*'

    TargetFolder: 'C:'

    ##[section]Starting: CopyFiles
    ==============================================================================
    Task : Copy files
    Description : Copy files from a source folder to a target folder using patterns matching file paths (not folder paths)
    Version : 2.158.0
    Author : Microsoft Corporation
    Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/copy-files
    ==============================================================================
    found 18 files
    Copying d:\a\1\s\ConsoleApp1\App.config to C:\App.config
    Copying d:\a\1\s\ConsoleApp1\bin\Debug\ConsoleApp1.exe to C:\bin\Debug\ConsoleApp1.exe
    Copying d:\a\1\s\ConsoleApp1\bin\Debug\ConsoleApp1.exe.config to C:\bin\Debug\ConsoleApp1.exe.config
    Copying d:\a\1\s\ConsoleApp1\bin\Debug\ConsoleApp1.pdb to C:\bin\Debug\ConsoleApp1.pdb
    Copying d:\a\1\s\ConsoleApp1\bin\Release\ConsoleApp1.exe to C:\bin\Release\ConsoleApp1.exe
    Copying d:\a\1\s\ConsoleApp1\bin\Release\ConsoleApp1.exe.config to C:\bin\Release\ConsoleApp1.exe.config
    Copying d:\a\1\s\ConsoleApp1\bin\Release\ConsoleApp1.pdb to C:\bin\Release\ConsoleApp1.pdb
    Copying d:\a\1\s\ConsoleApp1\ConsoleApp1.csproj to C:\ConsoleApp1.csproj
    Copying d:\a\1\s\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.FileListAbsolute.txt to C:\obj\Debug\ConsoleApp1.csproj.FileListAbsolute.txt
    Copying d:\a\1\s\ConsoleApp1\obj\Debug\ConsoleApp1.csprojAssemblyReference.cache to C:\obj\Debug\ConsoleApp1.csprojAssemblyReference.cache
    Copying d:\a\1\s\ConsoleApp1\obj\Debug\ConsoleApp1.exe to C:\obj\Debug\ConsoleApp1.exe
    Copying d:\a\1\s\ConsoleApp1\obj\Debug\ConsoleApp1.pdb to C:\obj\Debug\ConsoleApp1.pdb
    Copying d:\a\1\s\ConsoleApp1\obj\Release\ConsoleApp1.csproj.FileListAbsolute.txt to C:\obj\Release\ConsoleApp1.csproj.FileListAbsolute.txt
    Copying d:\a\1\s\ConsoleApp1\obj\Release\ConsoleApp1.csprojAssemblyReference.cache to C:\obj\Release\ConsoleApp1.csprojAssemblyReference.cache
    Copying d:\a\1\s\ConsoleApp1\obj\Release\ConsoleApp1.exe to C:\obj\Release\ConsoleApp1.exe
    Copying d:\a\1\s\ConsoleApp1\obj\Release\ConsoleApp1.pdb to C:\obj\Release\ConsoleApp1.pdb
    Copying d:\a\1\s\ConsoleApp1\Program.cs to C:\Program.cs
    Copying d:\a\1\s\ConsoleApp1\Properties\AssemblyInfo.cs to C:\Properties\AssemblyInfo.cs
    ##[section]Finishing: CopyFiles

    copying takes place. but, files not visible in that path. 

    Awaiting for your response.

    Thanks,

    Greeshma

    Tuesday, October 8, 2019 9:18 AM

Answers

  • Hi,

    I'm not sure I understand your exact requirement, but I'll give it a go:

    If this is a Azure DevOps Pipeline, it will copy the files to the system that is used for running the build. This is the system where the Build Agent is running. By default this is a hosted environment within Azure DevOps and not your local machine.

    If you'd like to have the files as a result from your build, you should add a step to include them as "Artifacts". These artifacts can be manually downloaded as a ZIP file after the build completes.

    You could also create a Release pipeline, in addition to your Build pipeline, to deploy the files to a target machine automatically. For this to work, you'll need to install an Azure DevOps release agent to your target machine.

    https://docs.microsoft.com/en-us/azure/devops/pipelines/artifacts/artifacts-overview?view=azure-devops

    https://docs.microsoft.com/en-us/azure/devops/pipelines/release/?view=azure-devops

    Kind regards,

    Johnny Hooyberghs

    • Marked as answer by GREESHMA K R Thursday, October 17, 2019 6:04 AM
    • Unmarked as answer by GREESHMA K R Thursday, October 17, 2019 6:04 AM
    • Marked as answer by GREESHMA K R Thursday, October 17, 2019 6:17 AM
    Tuesday, October 8, 2019 11:13 AM
  • Hi,

    You now have a build that actually builds your code into an executable and publishes it as an artifact.

    The next step would be to create a Release Pipeline that is connected to this build (and artifact). A release pipeline is similar to a build: it runs, using an agent on a machine, and executes a number of steps that you can customize yourself.

    1. From Azure DevOps, you create a new release pipeline and select the empty template.
    2. You should be able to link your release pipeline to the build artifact from the box called "Artifacts".
    3. From your only and empty stage without steps, you need to configure the agent that will run your actual release. You select the private agent pool and configure it using the "Manage" option.
    4. From the manage option, you can add new agents to your private agent pool and download the files needed to run it. Follow the documentation to install and configure the agent on your target machine.
    5. If the agent is up-and-running, you should be able to see it in Azure DevOps and select it while configuring your stage.
    6. In your stage, you can add steps to perform your actual deployment. If you just need to deploy your exe, you can use the step "Copy Files" to copy the files from the artifact to the actual folder on your target system (it will be able to copy because the agent is running on your target machine).

    I don't know all the details for this process by heart because they have changed a few times in the past. I just look and read documentation online to help me figure it out.

    Kind regards,

    Johnny Hooyberghs

    • Marked as answer by GREESHMA K R Monday, October 21, 2019 10:24 AM
    Friday, October 18, 2019 2:47 PM

All replies

  • Hi,

    I'm not sure I understand your exact requirement, but I'll give it a go:

    If this is a Azure DevOps Pipeline, it will copy the files to the system that is used for running the build. This is the system where the Build Agent is running. By default this is a hosted environment within Azure DevOps and not your local machine.

    If you'd like to have the files as a result from your build, you should add a step to include them as "Artifacts". These artifacts can be manually downloaded as a ZIP file after the build completes.

    You could also create a Release pipeline, in addition to your Build pipeline, to deploy the files to a target machine automatically. For this to work, you'll need to install an Azure DevOps release agent to your target machine.

    https://docs.microsoft.com/en-us/azure/devops/pipelines/artifacts/artifacts-overview?view=azure-devops

    https://docs.microsoft.com/en-us/azure/devops/pipelines/release/?view=azure-devops

    Kind regards,

    Johnny Hooyberghs

    • Marked as answer by GREESHMA K R Thursday, October 17, 2019 6:04 AM
    • Unmarked as answer by GREESHMA K R Thursday, October 17, 2019 6:04 AM
    • Marked as answer by GREESHMA K R Thursday, October 17, 2019 6:17 AM
    Tuesday, October 8, 2019 11:13 AM
  • Hi GREESHMA K R, 

    Thank you for posting here.

    According to your description, your issue is more related to Azure. Therefore, it will be more appropriate to ask your question in Azure Forums.

    The C# forum is for C# related question, we discuss and ask the C# programming language, IDE, libraries, samples and tools here.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, October 9, 2019 3:02 AM
  • Thanks Johnny Hooyberghs,

    Now I am able to publish artifacts. I have one doubt that, how can I deploy the artifact to a target machine automatically. Please explain it in detail. Waiting for you response. Thanks.


    Thursday, October 17, 2019 7:47 AM
  • Hi,

    You now have a build that actually builds your code into an executable and publishes it as an artifact.

    The next step would be to create a Release Pipeline that is connected to this build (and artifact). A release pipeline is similar to a build: it runs, using an agent on a machine, and executes a number of steps that you can customize yourself.

    1. From Azure DevOps, you create a new release pipeline and select the empty template.
    2. You should be able to link your release pipeline to the build artifact from the box called "Artifacts".
    3. From your only and empty stage without steps, you need to configure the agent that will run your actual release. You select the private agent pool and configure it using the "Manage" option.
    4. From the manage option, you can add new agents to your private agent pool and download the files needed to run it. Follow the documentation to install and configure the agent on your target machine.
    5. If the agent is up-and-running, you should be able to see it in Azure DevOps and select it while configuring your stage.
    6. In your stage, you can add steps to perform your actual deployment. If you just need to deploy your exe, you can use the step "Copy Files" to copy the files from the artifact to the actual folder on your target system (it will be able to copy because the agent is running on your target machine).

    I don't know all the details for this process by heart because they have changed a few times in the past. I just look and read documentation online to help me figure it out.

    Kind regards,

    Johnny Hooyberghs

    • Marked as answer by GREESHMA K R Monday, October 21, 2019 10:24 AM
    Friday, October 18, 2019 2:47 PM
  • Thanks Johnny Hooyberghs,

    Can I test my class library project (automation code) using build pipeline. It's not Unit test case. Used TestStack.White Framework on top. Awaiting for your response. Thanks.


    Friday, October 25, 2019 8:06 AM