I would like to be able to have App.myconfig files copies to the output directory like AssemblyName.myconfig, like it happens with App.config files. How can I do that without creating the targets from scratch
Oh, I get it. You want to rename them when they get copied. You can certainly do this by adding a custom AfterBuild action and using transforms, but let me ask the team and see if there's an easier way.
Are you using a project file within Visual Studio If so, just set the "Copy Local" property on the app.myconfig file to "Copy If Newer" or "Copy Always".
Simulating App.config behaviour
laurie0718
Neil
captainglassback
Neil
KSV
Ovatsus,
Just add the following just before the </Project> tag:
<Target Name="AfterBuild"
Inputs="@(MyFilesToCopy)"
Outputs="@(MyFilesToCopy ->'$(OutputPath)%(TargetPath)')" >
<Copy SourceFiles="@(MyFilesToCopy)"
DestinationFiles="@(MyFilesToCopy ->'$(OutputPath)%(TargetPath)')"/>
</Target>
This assumes you have an item in your project like
<ItemGroup>
<MyFilesToCopy Include="foo.myconfig">
<TargetPath>$(AssemblyName).myconfig</TargetPath>
</MyFilesToCopy>
</ItemGroup>
with TargetPath defined. You can change the item name, etc as you like.
Dan
yanickg