9

I've loved using the new VS 2012 Publishing Profiles, but when using them on a build server i'm unsure how to store the password.

When I tick the box the "save the password" it creates a .pubxml.user file and encrypts the password in an XML node.

When i run the deployment on a build server the password file always seems to be ignored.

I can get away with storing the password in a

<PropertyGroup>
    <Password>NotMyRealPassword>
</PropertyGroup

But given they are already encrypting it i'd love to use the VS Encryption if I can.

How do i unecrypt and fill the <Password> property without building a custom task to do so?

Also - if I did have to build a custom MSBUILD task, what type of encryption is in use in this SUO file?

1 Answer 1

12

As I was trying to write an answer to your question I realized that I'm not well suited to answer the quetsion, but I did want to make some comments on the .pubxml.user file.

When you save a web publish profile in Visual Studio we encrypt the password and store the encrypted value in the .pubxml.user file for the given publish profile. We encrypt this value on a per-user/per-machine basis. So if you take the same file to a different machine (or if a different user logged into the same machine) it would not decrypt to the correct value. Because of this it's not worth investigating if you can decrypt the value which is stored by VS on a build server.

6
  • 1
    Ahhh what a shame... I believe in cases like this that CI is the best place to put this infoas being able to test what your CI server is doing it pretty critical to avoid any CI/CD friction. diaryofaninja.com/blog/2011/03/27/… P.s thanks for being awesome and answering!
    – Doug
    Oct 9, 2012 at 11:13
  • 1
    So, after reading another of your posts Sayed, I should be passing it on the command line? This feels a little "code smelly" to me. Jan 20, 2015 at 9:36
  • 4
    Late to the party here, @Doug, but you can store msdeploy password in Windows Credential Manager and use the getCredential parameter of msdeploy (unsupported by the msbuild tasks though) Feb 3, 2015 at 11:34
  • Interesting. If you're following the "build server holds the keys" model that's a really nice hack - although the publish profile has no way to include that.
    – Doug
    Feb 4, 2015 at 17:11
  • 1
    Trying to automate publishing with msbuild, wanting to use credentials saved by Visual Studio (on the same machine and user), but so far that seems impossible? @Sayed am I right that this isn't supported, and if so where do I file a bug report (or is Microsoft actually recommending use of clear-string passwords on the commandline?)
    – NiKiZe
    Aug 23, 2018 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.