Friday, February 22, 2019

[SOLVED] "Wildcards in this project type are not currently supported" error in Wix projects.

I encountered an error "Wildcards in this project type are not currently supported" when I was trying to modify wixproj file to include BeforeBuild section to copy files from NuGet packages folder into project root directory.
Initially, I was referencing a Visual Studio documentation for a Copy MSBuild task and created the following snippet:
   
   <ItemGroup>
      <ServiceFiles Include="..\packages\ServiceArtifacts.1.0.1\content\**\*.*"/>
   </ItemGroup>

   <Target Name="BeforeBuild">
      <Copy
        SourceFiles="@(ServiceFiles )"
        DestinationFiles="@(ServiceFiles ->'service\%(RecursiveDir)%(Filename)%(Extension)')"
       />
    </Target> 
Immediately, I got the "wildcards not supported..." error when reloading project in Visual Studio. After a bit of research I updated the snippet as follows:
<PropertyGroup>
  <ServiceFolder>..\packages\ServiceArtifacts.1.0.1\content</ServiceFolder>
</PropertyGroup>

<Target Name="BeforeBuild">
  <CreateItem Include="$(ServiceFolder)\**\*.*">
    <Output TaskParameter="Include" ItemName="ServiceFiles" />
  </CreateItem>
  <Copy
  SourceFiles="@(ServiceFiles)"
  DestinationFiles="@(ServiceFiles->'service\%(RecursiveDir)%(Filename)%(Extension)')"
        />
</Target>
Save. Reload project file. Build.
Voila!
Everything is working now.