Here are the errors I get:
Cannot publish because a project failed to build.
Could not copy the file "obj\Release\JobsRunner.exe.config" because it was not found.
After an hour of searching for a similar problem, the closest thing I found was a problem with a missing exe file (I had a missing config file), I tried the suggested solutions but it didn't solve my problem.
The reason I'm posting this question is because: a. I still don't have a working solution b. I did found a workaround which I want to share with people who will experience the same issue.
My workaround relies on the fact that I'm willing to give up on publishing my config file since I already have a copy of it at the publish destination and it's not about to change in the near future. What I did was editing the .csproj file, where I found the last block to be the cause to the problem:
<!--Override After Publish to support ClickOnce AfterPublish. Target replaces the untransformed config file copied to the deployment directory with the transformed one.-->
<Target Name="AfterPublish">
<PropertyGroup>
<DeployedConfig>$(_DeploymentApplicationDir)$(TargetName)$(TargetExt).config$(_DeploymentFileMappingExtension)</DeployedConfig>
</PropertyGroup>
<!--Publish copies the untransformed App.config to deployment directory so overwrite it-->
<Copy Condition="Exists('$(DeployedConfig)')" SourceFiles="$(IntermediateOutputPath)$(TargetFileName).config" DestinationFiles="$(DeployedConfig)" />
</Target>
So I figured the problem was that the publish process tried overwriting a non existent file or something like that, and I removed that block. Now the publish works for me.
I also tried disabling ClickOnce since I've noticed this block is related to it, but with no success.
Does anyone has a better solution than my ugly workaround? :)
Thanks