none
Why is my ApplicationInsights.config not being published as part of the MSBuild task RRS feed

  • Question

  • Why is my ApplicationInsights.config file not being included in the build package when I build on the server. I am using Azure DevOps as the build server and I am using a standard Visual Studio build task. This is the MSBuild arguments

    /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\" /p:SkipPostSharp=True /p:AutoParameterizationWebConfigConnectionStrings=False


    Thanks Noel

    Tuesday, March 19, 2019 7:57 PM

Answers

  • The project I have been concerned about has been inherited from developers that are no longer around. It turns out that they have created a custom MSBuild targets file and have changed the project to import and use this custom file. It is in this action that the Application.config has been excluded. 

    Thanks for your assistance


    Thanks Noel

    • Marked as answer by N Anderton Saturday, April 6, 2019 12:33 AM
    Saturday, April 6, 2019 12:33 AM

All replies

  • Hello Noel,

    I also went through the details mentioned here, and would first like to take a look at your application's local Publish profile in VS.

    It should ideally look like this:

    • CustomProfile.pubcxml.user file



    • <ProjectName>.csproj file
      Unload your project (Right click on Project Name -> Unload Project) and edit the project's .csproj file (Right click on Project Name -> Edit <Project_Name>.csproj)



    • Publish Output
      The above mentioned settings would ensure that the ApplicationInsights.config file is included as part of your Publish artifacts, which would look like this:


    If this is not what you see, please try creating a new Publish profile afresh and tweak it to get the expected configuration. Post verifying this, I did try to publish the same using the MSBuild task in Azure DevOps and was able to see ApplicationInsights.config as part of the output build artifacts, supplying the same parameters that you mentioned in the question above:

    /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\" /p:SkipPostSharp=True /p:AutoParameterizationWebConfigConnectionStrings=False

    Please check if this works for you, or feel free to revert otherwise. Hope this helps!

    Tuesday, March 26, 2019 8:52 PM
    Moderator
  • Hello Noel,

    Have you had a chance to check if the above options help? Please let us know otherwise and we'll be happy to assist you!

    Sunday, March 31, 2019 6:57 AM
    Moderator
  • The project I have been concerned about has been inherited from developers that are no longer around. It turns out that they have created a custom MSBuild targets file and have changed the project to import and use this custom file. It is in this action that the Application.config has been excluded. 

    Thanks for your assistance


    Thanks Noel

    • Marked as answer by N Anderton Saturday, April 6, 2019 12:33 AM
    Saturday, April 6, 2019 12:33 AM
  • Glad to know that you were able to get through the issue. Thanks for sharing your findings with the Community!
    Saturday, April 6, 2019 10:06 AM
    Moderator