aoven
aoven

Reputation: 2352

MSBuild: How to override output filename to be different from Assembly Name?

I have 2 C# projects in my solution, both of them DLLs:

My setup process guarantees that only one of them will be installed at any given time. Whichever that might be, it will be picked up by the MyApp.exe bootstrapper when user runs the application.

Since both DLLs contain the same entry point, I'd like to keep the bootstrapper generic:

class Bootstrapper
{
    static void Main()
    {
        var asm = Assembly.Load("MyApp.UI");

        // Execute the UI entry point here.
    }
}

This means I have to give both DLLs the same Assembly Name in project options: "MyApp.UI". The problem is that MSBuild uses the Assembly Name as the output name which poses a conflict for me.

Is it possible to convince MSBuild to use a different filename instead, e.g. the project name?

Upvotes: 1

Views: 2943

Answers (2)

Clive
Clive

Reputation: 3550

You could add a <PostBuildEvent> to your build to rename your output assemblies to a common name.

Upvotes: 2

Adam Fyles
Adam Fyles

Reputation: 6050

This would be a function of the CoreCompile task, you would have to override it to modify the /out switch on csc. This is not recommended practice but would achieve your goal.

Upvotes: 1

Related Questions