.net - how to modify source with NAnt? -


Before creating the solution, I would like to modify the string in an .h file with NAT.

The .h file has a macro: #define SERVER_ADDRESS "www.customserver.net" and I would like to modify the string before deploying the software so that the address in the command line for each build custom address Can be made

Does anyone know how this can be done?

Thank you!

Anybody could do the task to help with this task, Loads in. What is really useful when you apply to change some areas of the file. For example, if one defines a template-like header file that looks like this:

  #ifndef MyMacros_h #define MyMacros_h #define SERVER_ADDRESS "@ SERVER_ADDRESS_TOKEN @ "#endif"  

can use the loadfile function to replace @ SERVER_ADDRESS_TOKEN @ with any string, and after that the actual actual header The job can be used to write the file out.

  & lt; Loadfile file = "MyMacrosTemplate.h" property = "theMacrosFileContents" & gt; & Lt; Filterchain & gt; & Lt; Replacetokens & gt; & Lt; Token key = "SERVER_ADDRESS_TOKEN" value = "www.customerserver.net" /> & Lt; / Replacetokens & gt; & Lt; / Filterchain & gt; & Lt; / Loadfile & gt; & Lt; Echo file = "MyMacros.h" message = "$ {theMacrosFileContents}" />  

This will generate a MyMacros.h file with the modified string for SERVER_ADDRESS.


Comments