I have the need to dynamically load different versions of the same dll's depending on various situations.
The dll's are created as part of the build process for other projects within the same solution.
For example
/MainSolution
/MainProject - Loads dll's using reflection dynamically
/AbstractProject
/DllProject1
/DllProject2
DllProject1 and DllProject2 need to be built before MainProject. MainProject depends on AbstractProject, and through reflection DllProject1/DllProject2. However Visual studio currently forces MainProject to build before DllProject1 and DllProject2. How can I get Visual Studio to build DllProject1/DllProject2 before MainProject?
From the main menu, select Window > Preferences . In the left pane, expand General, expand Workspace, and select Build Order. Disable the Use default build order option. Select a project from the list, then click the Up or Down buttons to position the project where you want it to appear in the build order list.
You can manually change the build order through the workspace preferences (Window > Preferences > General > Workspace > Build Order). Changing these preferences manually may cause build errors.
You can view the project dependencies by selecting Build Dependencies\Project Dependencies from the context menu on a project in the solution explorer.
Visual Studio allows you to set explicit build dependencies in the solution (as opposed to implicity dependencies e.g. from traversing your references). Just right-click on your solution and find the Project Dependencies menu item:
The dialog that opens will allow you to set build dependencies and show you the calculated build order (you can affect the order by changing the dependencies).
The solution I found was to do the following:
Open up the .sln file, and change the order in which they projects are listed. Dropping MainProject down to the bottom. Then when I opened up the solution, it had DllProject1 and DllProject2 listed above MainProject in the build order.
Edit: While this works, there is no rhyme or reason for how it works. Randomly switching the order results in randomly changing the build order for projects that have the same dependents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With