If I want to use the ExomeDepth to detect CNV, how can I to build a reference exome set ? Do I need a sample that may not contain the CNV I want to detection ? That is to say , I should get the two exome sequencing at the same time ??
Yes the exomes that are part of the reference set should not contain the same CNV. If this is the case you cannot detect the CNV of interest of course. So if you deal with a family you want to exclude related individuals.
And ideally all these exomes (the test one and the reference exomes) should all have been generated as part of the same sequencing batch. You can try with exomes generated in different batches but the resulting CNV calls are likely to be much less accurate.
If these conditions are met, ExomeDepth should be able to build a good exome reference set by combining the most appropriate exomes (that is what the function select.reference.set does).