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

  • SEARCH
  • Home
  • 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 8155481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:40:51+00:00 2026-06-06T16:40:51+00:00

I’m new to MSBuild and I’m trying to set up a single MSBuildSettings.xml file

  • 0

I’m new to MSBuild and I’m trying to set up a single MSBuildSettings.xml file in my project, called via the “Post-build event command line” option in the Project Preferences, that does 3 particular tasks.

$(MSBuildBinPath)\msbuild.exe "$(ProjectDir)MSBuild\MSBuildSettings.xml"

The MSBuildSettings does 3 particular tasks. My first 2 tasks (“YUI” and “LESS”, below) are working perfectly. The new task I’m trying to add (“Encrypt”) is to encrypt the web.config AFTER transformation has occurred.

I’m using a single xml file structured as follows:

<Project DefaultTargets="YUI;LESS;Encrypt;">
    ...
    <Target Name="YUI">...</Target>

    <Target Name="LESS" DependsOnTargets="YUI">...</Target>

    <Target Name="Encrypt" AfterTargets="CopyAllFilesToSingleFolderForPackage">
        <Exec Command="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef &quot;connectionStrings&quot; $(MSBuildProjectDirectory)\..\obj\Release\Package\PackageTmp -prov &quot;MyProtectedDataProvider&quot;" />
    </Target>
</Project

I’ve basically trying to encrypt the connectionStrings section using the aspnet_regiis via commandline. (I also have my own Provider defined and working.) I do find it a little strange that I’m trying to modify the web.config in the PackageTmp folder, but as far as I can tell that’s the final location before the transformed web.config is deployed (I obviously don’t want to update the original web.config file in the project). I don’t think there’s anything wrong with the command/execution so much as it is the timing of it. I simply can’t figure out how to make this third step execute only AFTER transformation has occurred.

I’ve enabled the Detail view option of the build output as well as dug through the Microsoft.Web.Publishing.targets file trying to come up with a target that I can use as to only invoke my web.config encryption step AFTER the transformation has occurred, but regardless of what AfterTargets I try, I seem to always get:

The target "whatever" does not exist in the project.

I’ve tried PipelinePreDeployCopyAllFilesToOneFolder, TransformWebConfig, PipelineTransformPhase, CopyAllFilesToSingleFolderForPackage, etc..

Additional notes: I understand that the web.config is only transformed upon Publish (and I am publishing using the File System option).

Also this is plain MSBuild (no TFS team build or anything like that).

Any additional or alternative options on a post-transform step to encrypt sections of the web.config would also be greatly appreciated.

  • 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-06T16:40:53+00:00Added an answer on June 6, 2026 at 4:40 pm

    I finally wound up using only the *.wpp.targets file with the following structure:

    <Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
        <Target Name="AfterBuild">
            ... My YUI steps and my LESS steps ...
        </Target>
        <Target Name="Encrypt" AfterTargets="CopyAllFilesToSingleFolderForPackage">
            ... My web.config encrypt steps ...
        </Target>
    </Project>
    

    Honestly, I don’t completely understand the reasoning behind the naming of the first step (AfterBuild) and it just automagically knowing when to run. I’d really rather have my own name and a clear AfterTargets or BeforeTargets or something, but I didn’t have any luck with that approach. The second Target with the AfterTargets makes some sense to me.

    But anyway, it works. Everything is now just in the one wpp.targets file and seems to work great. It’s a little bit of a pain having to unload/reload the project file every time you make a change to the wpp.targets file though – that’s just goofy.

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

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
In my XML file chapters tag has more chapter tag.i need to display chapters
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.