I added app.config transforms to an existing Windows Forms client application that uses ClickOnce publishing, and now it will not publish. Error message:
"obj\Release\Client.csproj.App.config;obj\Release\MyAppName.exe.config" is an invalid value for the "ConfigFile" parameter of the "GenerateApplicationManifest" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem"
When I uncheck "Enable ClickOnce security settings" (project properties > Security), the project will build and run from Visual Studio 2015 without this error, but when I try to publish using ClickOnce, the error returns. Enabling security results in the project not building at all. Either way, the error is the same.
The app.config is set to to "Copy Always".
I tried removing the clickonce certificate and installing a new one with no difference in symptoms.
Note this is a Windows Forms application, not a web app. The transforms were created using the Configuration Transform extension (works the same as SlowCheetah). I've used this setup for other applications successfully, and so far haven't found a difference in the settings between this app and the successful ones.
This section of the .csproj file seems to be related to the issue:
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="AfterCompile" Condition="Exists('App.$(Configuration).config')">
<!--Generate transformed app config in the intermediate directory-->
<TransformXml Source="App.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="App.$(Configuration).config" />
<!--Force build process to use the transformed configuration file from now on.-->
<ItemGroup>
<AppConfigWithTargetPath Remove="App.config" />
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
</Target>
Another post suggested removing the ItemGroup node. When I do this, the project builds and runs in VS, and is able to be published to a test location, but the app.config transform doesn't happen.