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
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".
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.
Simulating App.config behaviour
Mike_1232123432
Neil
cmb1
Neil
Jonathan Eden
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
MS_ISV