title: How to specify a custom parameters.xml when building a Web Deploy package for ASP.NET Core?
body: <h2>Overview</h2>
  
  <p>I am building a deployable web package that can be imported into IIS that automatically prompts for settings needed by my ASP.NET Core application.  I already created a package that will deploy just fine, except after deploying, I need to manually find/edit my appsettings.json file.</p>
  
  <p>I know this package can include a <code>parameters.xml</code> file that will automatically prompt and fill in my appsettings.json when importing an app into IIS.  I have already made a parameters.xml file, and manually added it to my package after building it; it worked as expected.  I'd just like to have msbuild automatically add the parameters.xml file to the package for me.</p>
  
  <p>A separate project of mine (ASP.NET MVC 4) already does this.  For that, I simply needed to put my <code>parameters.xml</code> in the same folder as my .csproj.  I tried doing the same here, but had no luck.</p>
  
  <h2>Repro Steps</h2>
  
  <p>I created an ASP.NET Core Web Application <a href="https://i.stack.imgur.com/ekcbl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ekcbl.png" alt="ASP.NET Core Web Application"></a>
  Using .NET Framework on ASP.NET Core 1.1
  <a href="https://i.stack.imgur.com/dHgpb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dHgpb.png" alt=".NET Framework with ASP.NET Core 1.1"></a>
  I then went to publish my website</p>
  
  <p><a href="https://i.stack.imgur.com/jOTIT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jOTIT.png" alt="Publish dropdown"></a></p>
  
  <p>Selected 'Folder' (just to get a template)
  <a href="https://i.stack.imgur.com/GuuNL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GuuNL.png" alt="Folder Publish"></a></p>
  
  <p>I then edited the profile and changed the <code>WebPublishMethod</code> to <code>Package</code> and added the three lines below it.</p>
  
  <pre><code>&lt;DesktopBuildPackageLocation&gt;bin\$(Configuration)\$(MSBuildProjectName).zip&lt;/DesktopBuildPackageLocation&gt;
  &lt;PackageAsSingleFile&gt;true&lt;/PackageAsSingleFile&gt;
  &lt;DeployIisAppPath&gt;External&lt;/DeployIisAppPath&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Hda1Z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Hda1Z.png" alt="Modified publish profile"></a></p>
  
  <p>I then published one more time.  Now I get a WebDeploy package that I can deploy to IIS.  </p>
  
  <p>Great!  but... </p>
  
  <p>I'd like to customize the parameters.xml.</p>
  
  <p><a href="https://i.stack.imgur.com/ftoSY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ftoSY.png" alt="Parameters.xml I&#39;d like to customize"></a></p>
  
  <p>For previous projects, I was able to add a <code>parameters.xml</code> file to my project root, and VS/msbuild would automatically add it to my published package.  This currently works for a different project using ASP.NET MVC 4.</p>
  
  <p>So, I tried the same thing for this project.  First I added a settings.json with a very simple setting:</p>
  
  <pre><code>{
    "SettingName": ""
  }
  </code></pre>
  
  <p>Then I added a <code>parameters.xml</code> file that I know works to my project root.  (If I manually replace the parameters.xml file in Sample.zip package, it correctly prompts and replaces my setting when deploying)</p>
  
  <pre><code>&lt;parameters&gt;
    &lt;parameter name="IIS Web Application Name" value="External" tags="IisApp"&gt;
      &lt;parameterEntry kind="ProviderPath" scope="IisApp" match="^c:\\users\\joshs\\documents\\visual\ studio\ 2017\\Projects\\Sample\\Sample\\obj\\Release\\net461\\win7-x86\\PubTmp\\Out\\$" /&gt;
    &lt;/parameter&gt;
    &lt;parameter name="Setting Name" description="Enter a custom app setting" defaultValue="Default Setting Value"&gt;
      &lt;parameterEntry kind="TextFile" scope="obj\\Debug\\net461\\win7-x86\\PubTmp\\Out\\appsettings\.json$" match="(?&amp;lt;=\&amp;quot;SettingName\&amp;quot;\s*:\s*\&amp;quot;)[^\&amp;quot;]*" /&gt;
    &lt;/parameter&gt;
  &lt;/parameters&gt;
  </code></pre>
  
  <p>Again, I right click and <code>Publish</code> once more.  This time with the parameters.xml file.</p>
  
  <p><a href="https://i.stack.imgur.com/rWnAp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rWnAp.png" alt="Project structure with Publish menu shown"></a></p>
  
  <p>I expect the Sample.zip to contain the parameters.xml that I added to my project root, but it does not.  It is the exact same as from my original publish.</p>
  
  <h2>Question</h2>
  
  <p><strong>During the build process when creating a web deploy package, how do you include custom settings in the parameters.xml?</strong></p>
  
  <h2>I have already tried this...</h2>
  
  <p>I already looked at <a href="https://stackoverflow.com/a/46338042/2494785">https://stackoverflow.com/a/46338042/2494785</a>, but with no luck, though my command differed slightly from the original poster.</p>
  
  <pre><code>PS C:\Users\joshs\Documents\Visual Studio 2017\Projects\Sample&gt; &amp; 'C:\Program Files (x86)\Microsoft Visual Studio\2017\E
  nterprise\MSBuild\15.0\Bin\MSBuild.exe' .\Sample.sln /t:Sample /p:DeployOnBuild=true /p:PublishProfile=FolderProfile /p:
  ProjectParametersXMLFile="C:\Temp\parameters.xml"
  </code></pre>