1

I am currently creating a solution that must both work with localdb and sqlservercompact 4.0, using EntityFramework Code First. I created therefor extra builconfigurations: LocalDb and SQLCE. Obviously I need different app.config files for these build configurations. I found this excellent solution and used its second option: changing the MSBuild behaviour by using an AfterBuild directive. So I included the XML below in the WPF-application's project file:

<Target Name="AfterBuild">
    <Delete Files="$(TargetDir)$(TargetFileName).config" />
    <Copy SourceFiles="$(ProjectDir)\Config\App.$(Configuration).config" DestinationFiles="$(TargetDir)$(TargetFileName).config" />
  </Target>

This works beautifully on my Win8 development laptop at home, but it seems that the directive is ignored on my Win7 desktop at work. I noticed that where my class.dll's have commented out templates to add PreBuild and AfterBuild directives, the WPF-application did not have it. I checked the Build screen to see if the directive was executed and it was. Seemingly the change is not picked up or overwritten once more. What is happening?

Community
  • 1
  • 1
Dabblernl
  • 15,831
  • 18
  • 96
  • 148

1 Answers1

0

Never mind: the solution above was for class libraries, for instance for unit test projects. For desktop applications you do need Slow Cheetah. Works like a charm.

Dabblernl
  • 15,831
  • 18
  • 96
  • 148