none
Broken .Net Assembly references on my Visual Studio 2015 projects RRS feed

  • Question

  • I have a solution that hosts dozens of projects. But broken references only happened to 2 projects, which target 4.5.2.

    I do, however, have other project in the same solution that targets the same framework assemblies and builds okay.

    I can manually remove the reference (e.g. to System) and added it back.

    It still shows broken.

    What went wrong?

    Thank you.

    Brian

    Wednesday, September 9, 2015 2:38 PM

Answers

  • The issue is resolved.

    My colleague pointed out that there is a packages folder which came from TFS and I should delete it.

    I did that. Now all references are okay now. I guess the packages folder has some obsolete/missing assemblies and after removal auto package restore fixed it.

    Visual Studio behaved weird and it misled me in believing that .Net core assemblies are not resolving by showing me the exclamation marks on them.

    Thank you for your help.

    Brian

    • Marked as answer by BrianWu Friday, September 11, 2015 12:34 PM
    Friday, September 11, 2015 12:25 PM

All replies

  • "It still shows broken."

    Please clarify by what you mean by broken.  Build errors?  If so then please post the build errors.  Warning icon on reference? If so then please provide text.  Have you verified the path(s) to the references is valid?  Did you recently update your project framework version and forget to refresh any NuGet packages you were using?  Are you using any assemblies that require a higher framework version than you're targeting?

    Michael Taylor
    http://blogs.msmvps.com/p3net

    Wednesday, September 9, 2015 5:24 PM
    Moderator
  • Hi Michael,

    By broken I meant that the references have exclamation marks on them (!).

    I cannot build the project.

    The target framework is 4.5.2 and I have them.

    Wednesday, September 9, 2015 6:34 PM
  • Mouse over the references and it should display a message about why. It should also complain in the build. What build errors are you getting? If you have multiple projects then it is important to note that all dependencies need to be less than or equal to the target project's framework version otherwise you'll get errors.
    Wednesday, September 9, 2015 7:03 PM
    Moderator
  • Mouse over broken references doesn't show any information. And here are the error messages on build -

    Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props. AvocetWebCore D:\Avocet\AvocetMain\Trunk\AvocetWebCore\AvocetWebCore.csproj 285

    Error CS0103 The name 'InputScreenDynamicCodeCache' does not exist in the current context MobileClientObjects D:\Avocet\AvocetMain\Trunk\MobileClientObjects\ScreenControllers\TransInputScreenController.cs 289

    I don't think it's relevant though since I have reference issue on .Net assemblies, not 3rd party.

    Thank you.

    Thursday, September 10, 2015 5:22 PM
  • So the error you're getting is because your project is referencing the Roslyn compiler NuGet package from the AvocetWebCore project.  Because that project is failing you are getting subsequent errors. It looks like the package is used for hosting the Roslyn compiler for scripting purposes. Does this sound like a feature you need? You should remove the Nuget package reference if you don't need it. If you do need it then you'll need to ensure that NuGet restore is turned on. It depends upon how old your project is but you'll either be using the MSBuild or Automatic restore option. Auto restore is the correct approach going forward but I'd get it building correctly first before switching.
    Thursday, September 10, 2015 5:32 PM
    Moderator
  • The issue is resolved.

    My colleague pointed out that there is a packages folder which came from TFS and I should delete it.

    I did that. Now all references are okay now. I guess the packages folder has some obsolete/missing assemblies and after removal auto package restore fixed it.

    Visual Studio behaved weird and it misled me in believing that .Net core assemblies are not resolving by showing me the exclamation marks on them.

    Thank you for your help.

    Brian

    • Marked as answer by BrianWu Friday, September 11, 2015 12:34 PM
    Friday, September 11, 2015 12:25 PM