dotnet / dotnet/msbuild

Compile error when switching between branches from new format back to branch with old format

Open
#3,097 9 comments 1 reaction 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

I'm trying to upgrade some libraries in a big solution, it's a step by step process, one lib at a time, so I'm using a separate branch along the way. When switching back to main branch to do some unrelated work I noticed nothing would compile anymore.

Note I'm not sure if msbuild is the correct place to file this issue, the error comes from the nuget.target.
Please let me know where to file otherwise and I'll open an issue there.

### Steps to reproduce
- Create a new VS project (Class Library, .NET Framework) 4.5.2
- Make sure it compiles, commit changes to git
- create new branch "convert" (or whatever)
- delete the assemblyinfo.cs
- Unload project, replace all with
```


netstandard2.0

```
- Reload, make sure it compiles
- Commit to this branch
- switch branches back to master (or whatever the branch was)
- Try to compile
- Get angry because it says
```1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(186,5): error : Your project is not referencing the ".NETFramework,Version=v4.5.2" framework. Add a reference to ".NETFramework,Version=v4.5.2" in the "frameworks" section of your project.json, and then re-run NuGet restore.```
- I thought VS cached something, but even deleting the .vs folder completely and reoping the solution still leaves me unable to compile my project.
- Note that switching to the netstandard branch again compiles fine

OS info:

Win 10, VS 15.6.2 Professional

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.