zoukankan      html  css  js  c++  java
  • Finding missing files in Visual Studio

    Finding missing files in Visual Studio

    A project in Visual Studio is used to indicate which files on disk should be used to build something. For a C# project, it will indicate the .cs files that should be compiled.

    It is possible to have a file on disk that isn’t included in the project (the file is just ignored), and conversely it is possible to have a file reference in the project that refers to a file that doesn’t exist on disk. In this latter scenario, if it is a compilable (.cs) file then the C# compiler will issue an error that it can’t find the file. But if it is another kind of file (like a .jpg, .png or .css for example), the compiler just ignores it and you won’t get any errors.

    If you didn’t realise that there are some missing files, then the first time you might actually realise this is when either you go to package the application for deployment (when the packaging step could fail), or when you run the application and some functionality is broken.

    Here’s a Solution opened in Visual Studio. I can tell you there are actually two files that are missing, but there’s no clue as to where they might be.

    Missing files are identified by a slightly different icon with a yellow ‘warning’ triangle in the Solution Explorer, but that’s only helpful if you’re actually looking at the right place (not always easy if you have lots of projects with a deep folder hierarchy). If we expand the first folder out, then we can see the first missing file. 

    But there’s still another one we haven’t found. If you don’t go looking for it, you probably won’t notice it. So to help identify missing files as soon as possible, I’ve created a new Visual Studio extension – Show Missing Files.

    After you do a build, the extension scans all the projects you have loaded in Visual Studio and generates errors for any files that are referenced but don’t actually exist. Here’s the Error List window for our sample solution after doing a build:

    需要注意的是,这里的提示,和vs原本自带的错误提示,会在一起。

    Error CS2001 Source file 'CMSFormControlsMacrosMacroOperatorSelector.ascx.cs' could not be found.  这个是原生的
    Error File referenced in project does not exist    这个是插件显示的,只有这个可以双击跳转

     The two missing files are listed, along with the projects that reference them. You can then double-click on one of the errors and it will take you directly to the file reference in the Solution Explorer.

    And there it is! You can now fix the missing reference (eg. remove it, or restore the missing file back on disk).

    Show Missing Files is available for Visual Studio 2013 and 2015. Try it out today in the Visual Studio Gallery or search for “Show Missing Files” in the Visual Studio Extensions and Updates dialog.

    Don’t forget to give it a few votes in the gallery. The source code is available at https://github.com/flcdrg/VsShowMissing. All contributions welcome!

     https://marketplace.visualstudio.com/items?itemName=DavidGardiner.ShowMissing2019

  • 相关阅读:
    kis 7.5和360似乎存在兼容性的问题,
    mysql timeout
    update users set a=1 where id in (1,2,3)这句在rails中该如何写呢
    mysql数据库 text类型的长度限制,使用change_column来进行长度的修改并不影响原有数据
    杭州的一个托管idc商
    User.find_each
    ruby 批量更新
    mongodb kt双机房灾备
    imagemagick使用
    kingdee kis
  • 原文地址:https://www.cnblogs.com/chucklu/p/15015344.html
Copyright © 2011-2022 走看看