I am using (DTE) GetService(typeof (DTE))
to get information about the currently opened solution in my Visual Studio package.
When the code builds the solution (see code below) it locks the DLL file, so even after the MenuItemCallback
method has finished I can't build my solution either using the usual menu option, or selecting the package menu option again.
Method which is called when I select the menu option in the Experimental Instance of Visual Studio:
private void MenuItemCallback(object sender, EventArgs e)
{
var solutionBuild = ((DTE) GetService(typeof (DTE))).Solution.SolutionBuild;
solutionBuild.Build(true);
if (solutionBuild.LastBuildInfo == 0)
{
ShowMessage("The solution built");
}
}
How can I make it release the DLL so that I can continue to edit the solution after running the package option?
Turned out this wasn't happening after all, the program just appeared to work at odd times which really confused me. Turned out something else in my code was using the DLL file as well and that was locking it!