WPF Application Always Rebuilds In Visual Studio
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
### Background
In attempting to reproduce the issue for #4217 I attempted to create a fresh WPF Project to see if I could reproduce it; in doing this I encountered a similar (but I do not believe identical) issue wherein the MainWindow.g.cs was always regenerated.
### Steps to reproduce
Please find an attached zip file that contains the project that demonstrates this behavior: [WpfAppAlwaysRebuilds.zip](https://github.com/Microsoft/msbuild/files/2956954/WpfAppAlwaysRebuilds.zip)
This project was created by:
1. Creating a new WPF Application within Visual Studio
2. Modifying the CSPROJ To contain the work around for #1648 as follows
```xml
```
To reproduce the issue on the command line build the project
```
msbuild WpfAppAlwaysRebuilds.sln /t:Build
```
Then launch the Solution in Visual Studio and build you will see this in diganostic verbosity:
```
Project 'WpfAppAlwaysRebuilds' is not up to date. Input file 's:\temp\markupbug\wpfappalwaysrebuilds\wpfappalwaysrebuilds\obj\debug\mainwindow.g.cs' is modified after output file ''.
------ Build started: Project: WpfAppAlwaysRebuilds, Configuration: Debug Any CPU ------
```
Note that in order to repeat it a second time you MUST delete the contents of the /obj/ folder to start "clean" again. Once it has built in Visual Studio once MSBuild will happily report that it is up to date.
### Expected behavior
The expected behavior is that this project will report as "up-to-date"
### Actual behavior
The project rebuilds because it determines that it is not "up-to-date"
### Environment data
`msbuild /version` output:
```
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
15.9.21.664
```
OS info:
Windows Server 2012 R2
If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
Visual Studio 15.9.8
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.