有时在PC重新启动后,Visual Studio会重建未修改的项目 [英] Visual Studio Rebuilds unmodified projects sometimes after a PC reboot

查看:97
本文介绍了有时在PC重新启动后,Visual Studio会重建未修改的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Visual Studio 2013解决方案,其中包含大约50个C#项目.通常,如果我选择构建(F6),它将仅构建已更改的项目.但是有时在我关闭并重新启动PC之后,当我选择build(F6)时,它会全部重建.为什么?

I've a Visual Studio 2013 solution with about 50 C# projects. Normally if I select build (F6) it just builds the projects which have changed. But sometimes after a I shut down and restart my PC it rebuilds all when I select build (F6). Why?

当我重新启动PC时,并不会一直发生这种情况.大多数情况下,它说重启后所有项目都是最新的.但有时它会重建所有内容.

This doesn't happen all the time when I restart my PC. Most of the times it says that all projects are up to date after a reboot. But sometimes it rebuilds all.

我看了以下问题 Visual Studio重建未修改的项目及其答案.

I took a look at the following question Visual Studio Rebuilds unmodified projects and its answers.

下一步是将构建输出的详细程度设置为诊断.

The next step I did was to set the build output verbosity to diagnostic.

在PC重新启动后Visual Studio全部重建时,我得到以下输出:

I'm getting the following output when Visual Studio rebuilds all after a PC restart:

1>Project 'Project1' is not up to date. Missing input file
...

行数更多(超过1000条).我看了看它们,但我仍然不明白为什么Visual Studio重建项目.

There much more lines (more than 1000). I took a look at them but I still don't understand why Visual Studio rebuilds the project.

更新

为什么Visual Studio需要以下文件?

Why does Visual Studio needs the following file?

1>Project 'Project1' is not up to date. Missing input file
'c:\users\wo\appdata\local\temp\.netframework,version=v4.5.assemblyattributes.cs'.
...

推荐答案

有时,在PC重新启动后,Visual Studio会重建未修改的项目

Visual Studio Rebuilds unmodified projects sometimes after a PC reboot

引起此问题的一种可能性是建筑帐户失去了对temp文件夹的权限. 要解决此问题,您可以尝试向temp文件夹授予read/write/execute权限,或者尝试以管理员身份运行Visual Studio 来查看它是否与权限相关

One possibility that caused this issue is that the building account lost permission to the temp folder. To resolve this issue, you can try to grant permissions read/write/execute to the temp folder, or maybe try running visual studio as administrator to see if it is permissions related.

我们知道,如果我们在Visual Studio中打开/构建项目,则.NETFramework,Version=v4.x.AssemblyAttributes.cs会自动出现在temp文件夹中.如果您在重新启动PC或未以管理员身份运行Visual Studio后失去了对temp文件夹的权限,我们将无法访问temp文件夹,则Visual Studio将报告在version=v4.5.assemblyattributes.cs. >文件夹.

As we know, if we Open/Build a project in visual studio, .NETFramework,Version=v4.x.AssemblyAttributes.cs appears in temp folder automatically. If you lost permission to the temp folder after restart PC or not running visual studio as administrator, we could not access the temp folder, then Visual Studio will report that it can not find the file version=v4.5.assemblyattributes.cs in the temp folder.

或者,您也可以通过在项目文件中添加以下属性,将该文件生成到Intermediate目录(通常称为obj)中:

Alternatively, you can also generate this file into the Intermediate directory (usually called obj) by adding following property to the project file:

  <PropertyGroup>
    <TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
  </PropertyGroup>

凭据:希望这会有所帮助.

这篇关于有时在PC重新启动后,Visual Studio会重建未修改的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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