title: How to use Visual Studio's Wix Toolset Extension to install a Windows Form application?
body: <p>Following <a href="https://wixtoolset.org/documentation/manual/v3/votive/authoring_first_votive_project.html" rel="nofollow noreferrer">this basic tutorial</a> I have created a Windows Form App (.NET Core) project in C# called MyApplication, and to the same solution, I added a Setup Project for WiX v3 called MySetup, both named as prescribed by the aforementioned tutorial. I am using Visual Studio 2019. I added the Windows Form App to the References node in the Solution Explorer, and as described by the linked tutorial, I added <code>&lt;File Source="$(var.MyApplication.TargetPath)" /&gt;</code> as shown below, to <code>Product.wxs</code>.</p>
  
  <pre><code>    &lt;Fragment&gt;
        &lt;ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"&gt;
          &lt;Component Id="ProductComponent"&gt;
            &lt;File Source="$(var.MyApplication.TargetPath)" /&gt;
          &lt;/Component&gt;
        &lt;/ComponentGroup&gt;
      &lt;/Fragment&gt;
  </code></pre>
  
  <p>When I build the Wix v3 project, I get an <code>msi</code> file. When I run this, it produces a <code>dll</code> file from my form application in the intended directory (<code>Program Files (x86)\MySetup</code> as per the instructions). This is nice, but I want an <code>exe</code> file so I can run the application from the installation directory.</p>
  
  <p>Reading <a href="https://docs.microsoft.com/en-us/cpp/build/reference/common-macros-for-build-commands-and-properties?view=vs-2019" rel="nofollow noreferrer">this article</a>, I guessed that the macro <code>$(var.MyApplication.TargetPath)</code> was the issue, but I was not able to find a way to change this. So, I tried to see what happened when I substituted this segment for the full path of the <code>exe</code> file (<code>\MyApplication\bin\Debug\netcoreapp3.0\MyApplication.exe</code>). Rebuilding and rerunning the <code>msi</code> file again, this successfully put the <code>exe</code> file in the desired location. However, when opening this exe, the Windows Form doesn't even show up, whereas in <code>bin\Debug\netcoreapp3.0\</code> it still opens a blank window as expected. My approach doesn't seem to be working at all, so I think I might be misunderstanding something fundamental about how to get this stuff working. </p>
  
  <p>My goal is to just get the <code>msi</code> to produce a working version of the blank Windows Forms application in <code>C:\Program Files (x86)\MySetup</code> as per the linked tutorial, instead of a faceless <code>dll</code>. Can anybody see where I am going wrong?</p>