Visual studio project.json does not have a runtime section - json

I ran into a error in visual studio 2017, I'm searching over the net but I don't find anything usefull, so my question is, how can I solve this:
Severity Code Description Project File Line Suppression State
Error Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore.
I was seaching for file where is located in my project but with no succsess.
Thanks

I got rid of this problem by manually deleting Visual Studio obj folder of the project that it's complaining about (the 'Clean Solution' command wasn't getting rid of it).
I found the answer through this and this threads.

I had the same issue after trying to migrate all my projects to the new .csproj format manually. I had an issue with one projet in the new format, so I reverted from git, and this message started to show up.
What I did:
Closed VS
Removed the .vs folder
Removed the packages folder
Restarted VS
Tried to build
Had issues with namespaces not found, as if packages were not installed
Opened NuGet package manager console
Ran Update-Package -reinstall -ProjectName <project>
Problem gone!
Hope it helps someone with the same issue :)

I upgraded a NuGet Package.
Then I undid some changes for the project, but the NuGet Packege had created a json file called project inside the project folder.
Inside this file, I could find runtimes.
But I just deleted this json file and built again.

Related

Visual Studio 2015 - Nuget Exception - GetFullVsVersionString must be called on the UI thread

While attempting to build or open a project in Visual Studio 2015 Update 3, I keep getting errors around nuget package management.
Whenever I build the project the first time after opening VS, I get the error message below.
I also get it when I try to open the nuget package manager dialog.
Anyone else experience this?
An exception was thrown while initializing part
"Nuget.PackageManagement.VisualStudio.VSolutionManager".
GetFullVsVersionString must be called on the UI thread.
Here is another thread in stack about this issue :
Visual Studio 2015 Initializing Part Nuget.PackageManagement.VisualStudio.VSolutionManager must be called on UI Thread
And here is in github :
GetFullVsVersionString must be called on the UI thread #3419
People say install this plugin for fix this issue.
But when i open that url i face this error :
We're sorry, the page you requested cannot be found!
In VisualStudio 2015 -> Tools -> Extensions and updates -> Online:
Search for the string: "Fix NuGet GetFullVsVersionString must be
called on the UI thread" and install the given fix.
Alternatively you can download the fix at : GetFullVsVersionString
fix
Now in February 2018, the latest NuGet Package Manager version
3.4.4.1321 does not have the fix included, so the patch must be applied.
As Steve Greene's answer describes, I also had the Telerik extension
installed, so that might have caused the problem.
I searched that phrase in VS - But could n't find anything.
Also GetFullVsVersionString fix does n't exist any more.
I also reinstalled nuget package manager - no help.
What is the solution?
EDIT 1 :
When i delete .vs hidden folder and open VS error vanished.
but when i close VS & reopen it again i face that error again.
What is wrong about .vs hidden folder?
Several suggestions:
1) disable any third installed party extensions under Tools--> Extensions and Updates--> Installed to check whether there is an extension that caused this issue.
2) Close VS, delete all files under C:\Users\xxx\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
You can also delete .vs hidden folder, bin and obj folder of the project.
Then, restart VS to test again.
Further, try to reinstall Nuget Package Manager extension again.
3) restore VS environment, enter C:\Users\Administrator\AppData\Local\Microsoft\VisualStudio\14.0
And you can just rename the 14.0 folder to another name like VS2015_Backup(just make a backup for your VS2015 environment).
Then, restart VS to test the issue.
4) open Control Panel-->Programs and Features-->right-click on VS2015 Program-->change-->Repair

The target "ResolveTagHelperRazorGenerateInputs" does not exist in the project

I am getting the following error when i try to build an AspNetCore Web Application targeting netcoreapp2.2.
Error MSB4057 The target "ResolveTagHelperRazorGenerateInputs" does not exist in the project. C:\Program Files\dotnet\sdk\2.2.103\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets
I have tried the following:
clear cache on vs according to this post
update vs2017 to 15.9.5
reinstall net core sdks
reinstall vs
Nothing helped. I first got the error during an upgrade from core 2.1 to core 2.2 on a different project, and it's possible that by mistake edited the
Sdk.Razor.CurrentVersion.targets file. From that moment on, i keep getting this error on any project that targets core 2.2 (even new ones).
Does anyone encountered this problem or have any clues about solving it?
Thanks
After long battles it figured out to be a problem with VS NuGet Package Manager.
All I had to do was:
VS > Tools > Options > NuGet Package Manager > Clear All NuGet Cache(s).
The Following Link was my solution. I also struggled to get this fixed.
Just copy the files from the NetStandard2.0 folder from GitHub then replace it with you Directory from the same location.
Hopefully this helps someone.!
Here is the Answered Link:
https://social.msdn.microsoft.com/Forums/en-US/cafc9823-eb61-46f7-8489-007242ef2ad2/target-quotresolvetaghelperrazorgenerateinputsquot-does-not-exist-in-the-project?forum=msbuild
Here is the GitHub Link
https://github.com/aspnet/Razor/tree/master/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0
I encountered the same issue during the Azure build pipeline process, and clearing the NuGet package cache resolved the issue.
Solution:
I used a dotnet tasks with "custom" to issue the following command before NuGet package restore task:
command:
dotnet nuget locals global-packages -c
Screenshot shows the build pipeline task
For me the solution was as follows:
In Visual Studio
Right click on each project and click "Unload Project"
Right click on each project and click "Reload Project"

TKCustomMap Version Conflict

This issue has been reported on GitHub here -
https://github.com/TorbenK/TK.CustomMap/issues/325
Has anyone else has struggled with this? I was stoked to find this nuget package because it does exactly what I'm looking for but it needs Places and some other GooglePlayServices installed and I can't install them because of this conflict.
I'm also not sure if uninstalling TK.CustomMap and then installing the Play Services would even help because the person who reported the issue on GitHub said-
I converted my app to .net 2.0 and had to use the newest Google play services
60.1142.1 for AdMob to work. It wouldn't install until I uninstalled TK.CustomMap, and now TK.CustomMap won't reinstall because it only want to use GooglePlayServices 42.1021.1
Severity Code Description Project File Line Suppression State
Error NU1107 Version conflict detected for Xamarin.GooglePlayServices.Tasks. Reference the package directly from the project to resolve this issue.
HunterTracker.Android -> Xamarin.GooglePlayServices.Base 60.1142.1 -> Xamarin.GooglePlayServices.Tasks (= 60.1142.1)
HunterTracker.Android -> HunterTracker -> TK.CustomMap 2.0.1 -> Xamarin.GooglePlayServices.Location 42.1021.1 -> Xamarin.GooglePlayServices.Tasks (= 42.1021.1).
That's pretty much the exact error I'm getting trying to install the other packages. There's no resolution on github.
Anybody found a work around? Or does anyone know how to "Reference the package directly from the project"?
Thanks to SushiHangover's comments above pointing me in the right direction I was able to discover what I needed to do here. I had an error updating the nuget packages of TK.CustomMap at first because v26 Xamarin.Android.Support.Vector.Drawable was targeting MonoAndroid8.0 and the update to v27 must target MonoAndroid8.1 So it took quite a bit just to be able to update the nuget packages in order to get the assemblies with later versions so I could use TK.CustomMap in my solution. But I was eventually able to get there. Here were the steps I followed (as best I can remember). I am unable to compile ios right now because I don't have a MAC so that fix will have to come later. This fix is for the shared project and Android project only
Download the TK.CustomMap-master from github
Extract it and delete the Sample project completely (I also deleted the UWP project as I'm not really interested in that at this time)
Opened and built then closed. Deleted packages folder, vs folder, bin and obj from Android and Shared Project (this step is probably not necessary but I did it so...)
In the packages.config in Android changed all targets from monoandroid80 to monoandroid81 save file
In the TK.CustomMap.Android.csproj for every v26.0.1 of any Xamarin.Android.Support or other Xamarin.Android util package changed 26.0.1\lib\MonoAndroid80 to 27.0.2.1\lib\MonoAndroid81 - save file
In the nuget folder in TK.CustomMap.nuspec changed the target framework in this section
<group targetFramework="lib\MonoAndroid7.0">
<dependency id="Xamarin.GooglePlayServices.Location" version="42.1021.1" />
<dependency id="Xamarin.GooglePlayServices.Places" version="42.1021.1" />
<dependency id="Xamarin.Android.Maps.Utils" version="0.5.0" />
<dependency id="Xamarin.Forms" version="2.5.0.91635" />
<dependency id="Newtonsoft.Json" version="10.0.3" />
</group>
to
<group targetFramework="lib\MonoAndroid">
so it could target any version
Opened and updated all nuget packages using package manager (not console). Built debug and release builds
At this point opened solution I had tried to implement TK.CustomMap in previously to attempt the fix. Remember the original issues was that the latest frameworks could not be used and 42.1021.1 frameworks were unable to locate com.google.gms.location and com.google.gms.places.ui files so they had to be updated or no TK.CustomMap
In the problem solution uninstalled TK.CustomMap from all projects
In the problem solution Android project added reference to all the dlls in the release folder of the Android bin file from TK.CustomMap project.
Installed updates for all Xamarin.Android frameworks in problem solution through Package Manager (not console)
Installed updates of all other nuget packages for all projects using Package Manager (not console)
Installed TK.CustomMap to Shared project using Package Manager (not console)
Added the References to the android project a second time. May or may not have helped.
Installed TK.CustomMap Nuget Package using Package Manager (not console)
Built and ran on Live Player successfully!!
Thanks to Sushi Hangover for the advice. I haven't seen any comprehensive tutorials anywhere on how to accomplish this so I figured I would post my own answer in case anyone else was looking. Definitely if you are new to VS all this stuff is no walk in the park in the beginning.
Thanks to #Travis Fleenor. This is my solution. I change a bit your sequence in order to work on mine.
1. Make sure the original proyect from github (https://github.com/TorbenK/TK.CustomMap) works and you can run it.
2. Update the nugets where you get the conflict. In my case I got conflicted in googleplay library version. I updated it in the original proyect and then assure it could run it.
3. Compile entire solution in release mode. Then, copied the generated dll from bin/release and pasted them in a folder in my desktop.
4. I referenced those dll to shared proyect and android proyect. I only used nuget package manager to install some missing packages needed for the tk.custom. Notice that you only will reference some dll that the proyect accept. For the mayority Visual will prompt ' dll already referenced' something.
5. first reference your shared proyect, later your android one. That's all. make sure the you ca recompile solution.
Hope this helps

"Error ... Could not load file or assembly 'MySql.Data.Entity.EF5, Version=6.9.9.0 ..."

In fact, I wanted MySql.Data.Entity.EF6, however, for some reason Visual Studio ADO EDMX editor wanted MySql.Data.Entity.EF5 (same version, 6.9.9.0).
First, I checked if the NuGet packages 'MySql.Data' and 'MySql.Data.Entity' were installed.
I then issued the following command in PowerShell to reinstall all packages to help fix any .net version errors:
update-packages -reinstall
and proceeded to verify that all references in web.config were correct; however, the error remained. I even reinstalled MySQL for Visual Studio 1.2.6, but still the same.
(FYI: Restarting Visual Studio at each step above)
The solution for me was to simply add a new "dummy" ADO Entities Data Model to the project, referencing the same database (not sure this matters), which seemed to correct some references (somewhere) within the solution/project to the wrong version of the MySQL DLL (the error said 'EF5', but it should have been looking for 'EF6'). I'm sure there was a cache somewhere that was doing this, but just not sure where.
Edit: In retrospect, I perhaps should have tried deleting the obj folder first, as there are some *AssemblyReferences*.cache files in there. I tried rolling back to a previous version of the source (using Git) to test this, but the old version works now! So I'm sure it must have been the obj folder, which is ignored by Git by default.

nuget package restore with MonoDevelop

I have a solution that is primarily developed in Visual Studio 2012. I would like to develop in MonoDevelop without major incompatibilities.
Thus far, I have installed mrward's nuget addin for MonoDevelop and things work if I manually add each package in packages.config through that interface. However, this is highly onerous. This addin doesn't have support for automated package restore as of this writing.
I downloaded nuget.exe from CodePlex ("NuGet command line utility", as it's labeled). I use a simple find/xargs combination to install all required packages:
find . -name packages.config | xargs -I '{}' mono nuget.exe install '{}'
This creates several dozen directories in the directory from which it is run instead of putting things under packages/ as expected, and it also doesn't touch the project files so MonoDevelop still thinks that it should be looking for package references in the directory from which MonoDevelop was started.
I therefore opened MonoDevelop from the working directory that contains all of these package folders, and I still get invalid references. I think this is probably because the project is looking for package_name/ reference, but the folders are name package_name.version/ in the working directory.
Any suggestions for a sane, simple way to interact with this solution? I'm next going to try modifying my shell command so that it automatically drops to project/packages and runs nuget from that directory.
Did you try using the -o command line parameter with NuGet.exe? You can use that to get the packages to install into a particular packages folder.
The NuGet addin for MonoDevelop supports package restore from version 0.6 or above. Right click your project and select Restore Packages. This will download all the packages defined in your packages.config for all projects in the solution. It uses NuGet.exe to do this.
Another way to get this working is to use the custom NuGet MSBuild target so the package restore happens at build time when using xbuild. It would require some manual editing of project files though. Under the covers the custom MSBuild target just uses NuGet.exe with a similar command line to what you have already just with the output directory option specified. So I would try the command line approach since that will be less work.
You would have to get the following files from the NuGet repository on codeplex:
NuGet.exe
NuGet.targets
NuGet.config
Put these in a directory somewhere. Typically these are put in a .nuget directory in the same directory as your solution file. Then you need to edit your project files to include the NuGet.targets file and also define the SolutionDir property. So something like this:
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
You will also need to enable package restore on your machine. You can do this using the NuGet addin for MonoDevelop in the Options dialog. Under Linux this is available from the Edit menu under Preferences. Then look in the NuGet - General options and there is a checkbox for enabling package restore.
There is an example project on GitHub created by Jonathan Channon which uses package restore and works when building with xbuild inside MonoDevelop. There is also an issue on GitHub about using NuGet restore on Linux which might be helpful.
Update: 2014-05-14: NuGet addin for MonoDevelop now supports package restore.