Why does Microsoft not allow you to link a build configuration to a publish profile. Instead it tells you to use the dropdown in the main VS interface.
I find this extremely annoying, because we use config transforms to change our config settings based on the environment we are publishing to (such as database connection strings). We also check-in the .Publish.xml file, so that the publish paths are saved in source control. If someone forgets to change the build configuration they could accidentally publish test to production or vice versa. If we could check in the build configuration selection with the publish profile we would not have this issue.
Does anyone know if Microsoft plans on changing this in the future?
Publish uses profiles (. pubxml files) to allow for multiple project configurations and multiple publish targets for a single project. The contents of the profile are XML and based on MSBuild. The Publish profile keeps credentials in a separate, hidden by default file that doesn't get checked-in.
On the computer where you have the ASP.NET project open in Visual Studio, right-click the project in Solution Explorer, and choose Publish. If you have previously configured any publishing profiles, the Publish pane appears. Click New or Create new profile. Select the option to import a profile.
pubxml files and Visual Studio 2017 shows a list of file names in Publish toolbar. To change name of publish profile, you should change file name and then unload and reload project. Here are the steps to rename publish profile: Go to Solution Explorer → Project → Properties → PublishProfiles.
By pure luck, I found this:
http://blogs.msdn.com/b/webdev/archive/2012/06/15/visual-studio-2010-web-publish-updates.aspx
If you install this update (related to Azure), then the publishing tools are updated to a wizard type interface that DOES tie a publish profile to a specific build configuration.
I don't really understand why this is tied to Azure, but it works perfectly for all types of publishing (I use the publish to a folder option). No more publishing with the wrong build configuration!
To get around this, you can write a batch script to do both parts of the process. Use MSBuild to build your projects in the required build configuration (we use release for our web apps). If all you need to do is copy the output, MSBuild should be able to do that for you as well with a copy task. If you need to deploy a web application, use MSDeploy command line tools to complete the publish command. Going command line with both of these tools opens up a lot of customization.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With