Adding Library Reference to MSTest project

Jun 3, 2011 at 7:56 PM
Edited Jun 3, 2011 at 7:57 PM

I started with a new ConsoleApplication and added a TestProject (default MSTest project)

Using Package Manager (or GUI) to add a reference to a library (in this case "Should" however other packages also fail)

Attempting to add using statement results in library not showing up

It also does not show up in the Object Browser

 

These steps are reproducible from different machines from different locations (unrelated to each other)

The only other similarities are that both machines have NuGet PackageManager, PowerCommands and Productivity Power Tools installed.

Jun 4, 2011 at 12:39 AM

Does building the project fix it?

Jun 4, 2011 at 12:41 AM

Sorry I forgot to mention that it doesn't.

Jun 4, 2011 at 12:48 AM

Strange. When I follow your exact steps, I can repro this, but the second I build it works fine.

Note that that in itself is slightly strange, because when I add Should to the Console app itself, intellisense works directly without building, so there may be something funky about the way test projects work.

But I cannot explain that building the project wouldn't fix it for you while it does for me. If you still type the 'using' and compile, does it actually fail?

Jun 4, 2011 at 12:52 AM

Weird. Building works on one machine and not the other. However closing and opening the solution seems to work fine on both.

 

Glad you were able to reproduce it though. This is, I've done this a lot before and it hadn't been an issue, it only started recently.

Jun 4, 2011 at 12:59 AM

This doesn't appear to repro when adding a reference to Should.exe without NuGet (i.e. by browsing to a local copy). In that case, intellisense works in the test project without building.

So there would appear to be some small difference in what NuGet does to add the reference compared to what happens with manual steps. Strange since NuGet is just calling the DTE to add the reference.

Jun 4, 2011 at 1:01 AM
Edited Jun 4, 2011 at 1:01 AM

Yeah, in my original "tweet" to Fowl I mentioned that it works if I reference by hand. Still strange :) Glad to find real bugs instead of just imaginary ones.