如何确切找出Visual Studio 2019为何重建未修改的.NET Core项目的原因 [英] How to find out exactly why Visual Studio 2019 rebuilds unmodified .NET Core projects

查看:234
本文介绍了如何确切找出Visual Studio 2019为何重建未修改的.NET Core项目的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个包含VS2019(16.1.1)中的.NET Standard 2.0和.NET Core 2.0项目(C#和F#)的解决方案.如果我多次构建而没有更改,则第二个及后续的构建应该说构建:0成功,0失败,X为最新",但是有时它每次都会重新构建一些项目.我该如何找出原因?

I'm building a solution containing .NET Standard 2.0 and .NET Core 2.0 projects (C# and F#) in VS2019 (16.1.1). If I build multiple times without changes the second and subsequent builds should say "Build: 0 succeeded, 0 failed, X up-to-date", but it sometimes rebuilds some projects every time. How do I find out exactly why?

有很多关于此的SO问题和博客文章,其中大多数建议将构建日志的详细程度设置为诊断",并寻找不最新".我做到了,找不到该字符串,也不是不是最新的"(但是最新"发生了很多次).因此,这似乎在VS2019中已更改.我也知道U2DCheckVerbosity注册表设置,但这仅适用于.NET Framework.仔细阅读构建日志输出是不现实的,因为它超过36万行,所以我需要知道要搜索的内容.

There are many SO questions and blog posts about this, most of them suggesting setting the build log verbosity to "Diagnostic" and looking for "not up to date". I've done that and the string is not found, nor is "not up-to-date" (but "up-to-date" occurs many times). So this appears to have changed in VS2019. I also know about the U2DCheckVerbosity registry setting, but that's only for .NET Framework. Reading through the build log output is unrealistic, as it's over 360 thousands lines, so I need to know what to search for.

请注意,关于问题可能是什么,我不是在寻找猜测-我正在寻找一种让VS/编译器知道的方法我.

Please note, I'm not looking for guesses as to what the problem might be - I'm looking for a way to get VS/the compiler to tell me.

推荐答案

我正在寻找一种让VS/编译器告诉我的方法. (对于VS2019)

I'm looking for a way to get VS/the compiler to tell me. (For VS2019)

很难重现相同的问题,因此我不确定您的问题的原因.但是,关于您要问的是在输出"窗口中查找最新相关信息的方式,也许您可​​以检查.c核心的Up To Data Checks option.

It's hard to reproduce same issue so I'm not sure about the cause of your issue. But as for what you're asking is the way to find up-to-date related info in Output window, maybe you can check the Up To Data Checks option for .net core.

Go Tools => Options => Projects and Solutions =>.net core => 最新数据检查.确保已检查Don't call MSBuild if a project appears to be up-to-date.然后将Logging Level更改为Info or Verbose.(根据需要选择合适的级别)

Go Tools=>Options=>Projects and Solutions=>.net core=>Up To Data Checks. Make sure you've checked the Don't call MSBuild if a project appears to be up-to-date. Then change the Logging Level to Info or Verbose.(Choose the suitable level according to your needs)

对于普通的.net Framework项目或C ++项目,build and run中的build output verbosity将有很大帮助.但是,当试图找到VS认为一个.net core or .net standard项目已经过时的原因时,我认为我们可以尝试使用此选项,因为它的输出更加清晰.

For the normal .net framework projects or C++ projects, the build output verbosity in build and run would be of great help. But when trying to find the reason why VS consider one .net core or .net standard project is out-of-date, I think we can try this option since its output is more clear.

例如:(一个.net Core项目依赖于带有Info level .net core最新检查的Standard项目):

E.g: (One .net Core project which depends on the Standard project with Info level .net core Up-To-Date Check):

如果在一个解决方案中有太多项目,我建议您一次构建一个项目,而不要构建整个解决方案,这样您就可以更轻松地找到重建的原因.

And if you have too many projects in one solution, I suggest you build one project one time instead of build the whole solution so you can locate the cause of the rebuild more easily.

这篇关于如何确切找出Visual Studio 2019为何重建未修改的.NET Core项目的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆