9

I'm having difficulties with serveral of my VB.Net projects that I have upgraded to Visual Studio 2015. These projects have be upgraded over many years from visual studio 2003 to 2005 to 2010 to 2012. The code will compile and run without error. Debug.Print statements correctly write values to the immediate window. However, if I enable a breakpoint and try to look at any value in the watch window then I get an error like this one, reported in the watch window's value column:

error BC32208: Project already has a reference to assembly 'projectname.resources'. A second reference to 'projectname.resources.dll' cannot be added.

Similarly, if I break into the code and hover the mouse over a variable name then I do not get a pop-up containing the variable's current value.

My projects without resources have upgraded without any problems.

Has anyone met this problem? Has the way that resources are stored in a project changed in 2015?

jo0ls
  • 389
  • 1
  • 9
  • looks like you're not the only one: https://connect.microsoft.com/VisualStudio/feedback/details/1419986/project-already-has-a-reference-to-assembly-when-try-to-view-variable-value – Phil Sep 01 '15 at 16:41

3 Answers3

6

FYI, I've just committed a fix for this that will ship in VS 2015 Update 2 (see https://github.com/dotnet/roslyn/commit/e683a8438d42d92a3d142ba53f38b33315c7dea2).

Another possible work-around for this issue in the meantime is to strong name sign your app (and the satellite assemblies). The debugger was correctly ignoring the multiple resource dlls in the strong name case but not in the "weak" name case.

Kevin Halverson
  • 547
  • 6
  • 7
  • 1
    Looks like the fix is indeed in Update 2 CTP, even though it's not listed in release notes. – skolima Feb 16 '16 at 12:56
  • Actually it's not fixed completely. It still occurs in immediate window and for some cases in watch window too. – Tereza Tomcova Feb 17 '16 at 15:40
  • Tereza, are you by chance using C#? (this particular error is specific to VB) For C#, there is a similar issue that was just fixed yesterday: https://github.com/dotnet/roslyn/pull/8783. This fix will be included in the final version of Update 2. – Kevin Halverson Feb 18 '16 at 17:48
2

I could reproduce the error - note: I'm in the UK:

  • Start a new windows forms project.
  • Set the form to localizable True.
  • Set the language to English.
  • Set the form title to English.
  • Set the language to English (United States)
  • Set the form title to English (United States)
  • Set the language to English (United Kingdom)
  • Set the form title to English (United Kingdom)
  • Add a click handler for the form.

.

Private Sub Form1_Click(sender As Object, e As EventArgs) Handles Me.Click
   Dim test As DateTime = Now
   Debugger.Break()
End Sub

Run the project and click the form - the watch window will display the error, and the popup over test will not show the date.

I've fixed my projects by removing unnecessary localisation. I guess it was adding English and English UK versions of the resources.

Edit: this worked for the simple cases, but some of the projects I maintain have circular dependencies. Yuck. In this situation, building any of the projects would pull in the unwanted resource dlls from a referenced project. To break the cycle I just deleted the unwanted dlls from the referenced project's bin folder before building, so that they are not copied in. I've 'sent a frown' to microsoft describing this problem. I've spent a day and a half now tidying up the mess...

jo0ls
  • 389
  • 1
  • 9
2

I figured out how to fix it. I went into the project properties, under Assembly and set the Neutral language - in my case to English - United States.

Problem solved!

Jeff O.
  • 21
  • 3