简体   繁体   中英

References don't show up in Visual Studio 2017 after creating a .NET Standard branch

I'm working with Visual Studio 2017 on the open-source project https://github.com/SpiegelSoft/XamarinForms.Reactive.FSharp

I recently created a branch called dotnet-standard, which, as its name suggests, is a migration to .NET Standard. However, after creating this branch and checking back in to the master branch, which is a PCL rather than a .NET standard library, the project will no longer build.

First of all, the references are not visible. All I can see in Visual Studio is a .NET node (see screenshot).

The build fails in the first instance with

Xamarin.Forms targets have been imported multiple times. Please check your project file and remove the duplicate import(s).

This is odd because the same fsproj file was working before I created the new branch.

When I delete the Xamarin.Forms import line in my fsproj file and then perform a git reset --hard , the error message changes to

Your project is not referencing the ".NETPortable,Version=v4.5,Profile=Profile259" framework. Add a reference to ".NETPortable,Version=v4.5,Profile=Profile259" in the "frameworks" section of your project.json, and then re-run NuGet restore.

But the IDE won't even let me aa project.json file. Something has clearly gone very wrong with my Visual Studio settings.

Does anyone have any obvious tips before I reinstall Visual Studio?

在此处输入图片说明

As alluded in the comments, VS / MS Build can trip up on previously generated files - often in the various obj folders.

To get back to a 'clean' state (the same as when you first clone a repo), run git reset —hard to revert any uncommitted changes and git clean -xfd to remove any untracked files and folders.

Assuming your .gitignore file is configured correctly, this last step should remove all temporary files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM