.Net Solutions, DLL's, Build orders etc
Got to learn some new thinigs about Visual Studio today. Basically I wanted to build a library and integrate it into an existing solution.
Steps: 1. Open Solution, Add new project of type "Class Library". Then create namespaces, classes, static library functions etc. Build it. Build OK, DLL ready.
Step 2: In other project ( where DLL is to be used), Add reference, Browse, Select Newly created DLL. Add using for DLL namespace. Call function in DLL. Call OK. Build this project.
Hiccup! Issue no 1: DLL project was using newer .Net version while other project (Lets say App project) was using slightly older version and so it's build was giving error - Type or namespace for Library namespace not found.
Bit of googling gave me solution. So set Lib's .Net version to same as App. Build OK.
Next step: Verify solution is building correctly. For this there's something called build order to consider. For this in VS there's a setting - "Project Build Order...". This can be reached after right clicking on Solution in Solution Explorer.
This opens a small dialog box where you can setup project dependencies and with correct dependencies appropriate build order is prepared. Here I set the app project to be dependent on Lib and the build order was updated accordingly. Voilla!
So I rebuilt the solution and it all worked out great!
Feels good when things work without much fuss!!!
Cheers!!!
Comments
Post a Comment