My target environment only accepts .cs files and complies them at run time.
My project has gui.cs and 4 other class files. Its about 9000 lines of code.
Is there a way to have all 5 files merged into 1 cs file as a post build event?
My target environment only accepts .cs files and complies them at run time.
My project has gui.cs and 4 other class files. Its about 9000 lines of code.
Is there a way to have all 5 files merged into 1 cs file as a post build event?
Why do you need a single .cs file? If you're trying to create a single class you could use partial classes... although it doesn't sound like a terribly good idea if you've got 9000 lines of code.
How do you want the merge to happen? If it's just straight concatenation:
copy Foo.cs + Bar.cs Output.cs
I suspect you'll want something a bit smarter though - in which case you should write a small tool to do the merge, and then run that tool in the post-build event.
Can you give us more details of why you want to do this though? There may be a better approach.
There is nothing in built to do this. But building a tool should be easy enough.
Other than using directives, which have to be included at the top, you should be able to just append the files.
As a duplicate using directive is only a warning:
E.g. the following compiles, with just one warning, for the duplicate using
:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
namespace ConsoleApplication1 {
class X1 {
public static void Do() {
Console.WriteLine("Hello world");
}
}
}
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
X1.Do();
}
}
}