Nuget says packages are missing, Package Manager Restore says all packages are installed - nuget

What have I done to my Solution!? D:
I'm not able to install anything from nuget anymore. At first I kept getting an error saying:
An error occurred while trying to restore packages. A root element is missing.
So pursuant to this answer on another question, I renamed all my packages folders to packages-old, started VS again and attempted a restore. The error persists and I still can't install any nuget packages.
Error List:
Severity Code Description Project File Line Suppression State
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props.
Package Manager Restore:
All packages are already installed and there is nothing to restore.
Time Elapsed: 00:00:00.0644890
========== Finished ==========
Additionally, there's a bunch of warnings most of which say the referenced component couldn't be found:
WarningIDE0006Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.
Warning The referenced component 'System' could not be found.
Warning The referenced component 'Microsoft.Web.Infrastructure' could not be found.
Warning The referenced component 'System.Web.Services' could not be found.
Warning The referenced component 'System.Configuration' could not be found.
Warning The referenced component 'System.Web.ApplicationServices' could not be found.
Warning The referenced component 'Antlr3.Runtime' could not be found.
Warning The referenced component 'System.Web.WebPages.Razor' could not be found.
Warning The referenced component 'Microsoft.AI.Web' could not be found.
Warning The referenced component 'System.Web' could not be found.
Warning The referenced component 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform' could not be found.
Warning The referenced component 'Microsoft.AI.DependencyCollector' could not be found.
Warning The referenced component 'Microsoft.AI.PerfCounterCollector' could not be found.
Warning The referenced component 'Microsoft.ApplicationInsights' could not be found.
Warning The referenced component 'System.ComponentModel.DataAnnotations' could not be found.
Warning The referenced component 'System.Web.DynamicData' could not be found.
Warning The referenced component 'Newtonsoft.Json' could not be found.
Warning The referenced component 'System.Web.Routing' could not be found.
Warning The referenced component 'System.EnterpriseServices' could not be found.
Warning The referenced component 'System.Xml' could not be found.
Warning The referenced component 'System.Web.Abstractions' could not be found.
Warning The referenced component 'System.Web.Mvc' could not be found.
Warning The referenced component 'System.Web.Optimization' could not be found.
Warning The referenced component 'System.Net.Http' could not be found.
Warning The referenced component 'System.Net.Http.WebRequest' could not be found.
Warning The referenced component 'System.Web.WebPages.Deployment' could not be found.
Warning The referenced component 'System.Web.Helpers' could not be found.
Warning The referenced component 'System.Web.Razor' could not be found.
Warning The referenced component 'Microsoft.AI.ServerTelemetryChannel' could not be found.
Warning The referenced component 'Microsoft.AI.Agent.Intercept' could not be found.
Warning The referenced component 'System.Xml.Linq' could not be found.
Warning The referenced component 'WebGrease' could not be found.
Warning The referenced component 'System.Drawing' could not be found.
Warning The referenced component 'System.Core' could not be found.
Warning The referenced component 'Microsoft.CSharp' could not be found.
Warning The referenced component 'System.Web.Extensions' could not be found.
Warning The referenced component 'Microsoft.AI.WindowsServer' could not be found.
Warning The referenced component 'System.Data.DataSetExtensions' could not be found.
Warning The referenced component 'System.Web.Entity' could not be found.
Warning The referenced component 'System.Web.WebPages' could not be found.
Warning The referenced component 'System.Data' could not be found.

An error occurred while trying to restore packages. A root element is missing.
When you get this error, you should make sure any XML file (or any file that would be interpreted as an XML file by visual studio, especially, nuget.config, .csproj. web.config,web.config.transform, and so on) has a correct XML structure - that is, one root element, for example, the <configuration> in the nuget.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
To detect the source of the error A root element is missing, you can create a new blank solution with a project. Then install any nuget package, if that error still exists, you should special inspect the file, nuget.config in the folder %appdata%\NuGet. If that error disappears, the error should more related to your project files, .csproj, web.config, web.config.transform and so on.
All packages are already installed and there is nothing to restore.
Typically this error appears when the project is not loaded, so make sure all your projects in the solution are loaded when you restore on the solution.

To deal with this error, enter the following command in the Nuget console window:
Update-Package -reinstall -ProjectName Your-Project-Name
This will update all missing files.

Related

R package installation with GitHub

I am trying to install the package "PITE" as it is mentioned in the codes used in the article "Subgroup Identification Clinical Trials via the Predicted Individual Treatment Effect". The codes are taken from "https://github.com/nicoballarini/PLOS-2018-PITE#subgroup-identification-clinical-trials-via-the-predicted-individual-treatment-effect". But I'm unable to load this package, it would be very helpful if anyone can tell me where am I going wrong? The error message that I get:
install_github("nicoballarini/PLOS-2018-PITE")
Downloading GitHub repo nicoballarini/PLOS-2018-PITE#master
✓ checking for file ‘/private/var/folders/ml/wj8v_nld19n52l2g3tvzmltr0000gn/T/RtmpD4r8z6/remotes186f6614c26d/nicoballarini-PLOS-2018-PITE-832e47b/DESCRIPTION’ ...
─ preparing ‘PITE’:
✓ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘PITE_0.1.0.tar.gz’
* installing *source* package ‘PITE’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
Error: package or namespace load failed for ‘broom’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so
Reason: image not found
Error: package ‘broom’ could not be loaded
Execution halted
ERROR: lazy loading failed for package ‘PITE’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/PITE’
Error: Failed to install 'PITE' from GitHub:
(converted from warning) installation of package ‘/var/folders/ml/wj8v_nld19n52l2g3tvzmltr0000gn/T//RtmpD4r8z6/file186f5ce8b676/PITE_0.1.0.tar.gz’ had non-zero exit status
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so
Reason: image not found

Unity Error: Unable to convert classes into dex format

I have created an Android Unity plugin (.aar file) which provides some custom positioning data to my Unity game. In my Unity script, I use,
var x = customClass.CallStatic<float>("getHeadX");
In order to get some location data. This method is called per frame to get the updated data (polling method) which makes it inefficient. Instead, I decided to call a C# method in my Unity script from my java code (plugin side) when the updated data is ready. To do this, in my java plugin, I wrote,
import com.unity3d.player.UnityPlayer;
...
UnityPlayer.UnitySendMessage("Manager", // gameObject name
"PluginCallback", // this is a callback in C#
"Hello from android plugin"); // msg which is not needed actually
However, the compiler complained that the package com.unity3d.player.UnityPlayer does not exist. So I copied classes.jar file from
C:\Program Files
(x86)\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\mono\Release\Classes
\classes.jar
into the 'libs' folder of my android plugin's project. I built it successfully and copied the generated .aar file (mylibrary-release.aar) into Assets\Plugins\Android folder of my Unity project.
When I build the Unity project (Using 'Internal' build system), it gives me this error:
IOException: Failed to Move File / Directory from
'Temp/StagingArea\android-libraries\mylibrary-release\classes.jar' to
'Temp/StagingArea\android-libraries\mylibrary-release\libs\classes.jar'.
UnityEditor.Android.PostProcessor.Tasks.ProcessAAR.Execute
...
This error happens because the classes.jar dependency has name conflict with classes.jar (made by unity out of my plugin). So I changed the dependency name to unity_classes.jar and this resolved the issue but now I'm getting a new error when building my unity application:
CommandInvokationFailure: Unable to convert classes into dex format.
C:/Program Files/Java/jdk1.8.0_102\bin\java.exe -Xmx2048M
Dcom.android.sdkmanager.toolsdir="C:/Users/kamran.shamloo/AppData/Local/Android/Sdk\tools"
-Dfile.encoding=UTF8 -jar "C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar"
stderr[ Uncaught translation error:
java.lang.IllegalArgumentException: already added:
Lbitter/jnibridge/JNIBridge; Uncaught translation error:
java.lang.IllegalArgumentException: already added:
Lbitter/jnibridge/JNIBridge$a; Uncaught translation error:
java.lang.IllegalArgumentException: already added:
Lcom/unity3d/player/NativeLoader; Uncaught translation error:
java.lang.IllegalArgumentException: already added:
Lcom/unity3d/player/ReflectionHelper; Uncaught translation error:
java.lang.IllegalArgumentException: already added:
Lcom/unity3d/player/ReflectionHelper$1; Uncaught translation error:
java.lang.IllegalArgumentException: already added:
Lcom/unity3d/player/ReflectionHelper$a; Uncaught translation error:
java.lang.IllegalArgumentException: already added:
Lcom/unity3d/player/UnityPlayer; Uncaught translation error:
java.lang.IllegalArgumentException: already added:
Lcom/unity3d/player/UnityPlayer$1; Uncaught translation error:
java.lang.IllegalArgumentException: already added:
Lcom/unity3d/player/UnityPlayer$10;
...
The classes.jar (which you later renamed it to 'unity_classes.jar') gets automatically included into the built .apk by Unity, so you shouldn't include it yourself again (in your Android plugin), even under a different name.
In other words, first your android plugin "embeds" this .jar file inside itself. Then, when Unity adds your plugin into the game project, it also adds its own copy of that .jar file (it does that for all android projects). Consequently, Unity essentially ends up having 2 copies of the same .jar file in the project and complains by saying 'unable to convert classes into dex format'.
So although you have to use this library (.jar file) in your project but you should not bundle this library with your project. How to do that? If you're using Android studio, you can achieve this by marking the .jar file as a dependency with the provided scope.
To do this, you can:
1) Go to 'build.gradle' of your module and change this:
compile files('libs/jars/unity_classes.jar')
to this:
provided files('libs/jars/unity_classes.jar')
Or
2) you can right-click on the module (in Android pane) and choose Open Module Settings. Then go to Dependencies tab. Find the Unity module (which I renamed it to unity_classes.jar) and change its scope to Provided.

unresolved symbols after converting VS2012 Windows 8 Metro solution to VS2013 (on Windows 8.1)

I have a question, which I'm currently unable to tackle effectively since I'm still unfamiliar with Metro app development. So please bear with me :)
Long story short, I have a large, complex VS2012 Metro app managed+native solution (currently built on Windows 8) into VS2013 targeting Windows 8.1.
I imported the solution into VS2013 (hosted on Windows 8.1), and run the conversion for it and all the sub projects therein. Stuff compile, but it is with the linker that we run into problems. This is an example of the linker errors we get:
error LNK2019: unresolved external symbol __imp___beginthreadex referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___mbsrchr referenced in function <blahblahblah>
error LNK2019: unresolved external symbol _getenv referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___beginthreadex referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___endthreadex referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___mbsrchr referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___mbsnbicmp referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___dupenv_s referenced in function <blahblahblah>
The thing is that for every single symbol that is 'missing', we can see the that the declaration is present in the MS Windows header files supplied with VS2013. Inspecting the references in each sub-project shows that they are referencing the Windows 'core' libs.
Any ideas why this is happening? Thanks.
we can see the that the declaration is present in the MS Windows header files supplied with VS2013. Inspecting the references in each sub-project shows that they are referencing the Windows 'core' libs
It is going to be difficult to diagnose what went wrong with this little information, but it is pretty clear that you are looking in the completely wrong corner for this problem. The missing symbols are not Windows api functions, they are C runtime support functions. They are only used in a C++ project, you've been looking at .NET projects.
So you'll need to focus on the one project that generates these linker errors, it is a C++ project. The linker command that's issued to get it to link to the .lib that has these symbols is completely automagic so there isn't much that can go wrong. The very first thing to do is to force a complete rebuild so it won't use outdated .obj and .lib files that were left over from a previous build in VS2012. Right-click the project and choose Rebuild.
And it is worth taking a look at the .vcxproj file for this project with a text editor (like Notepad) and ensure that the conversion went properly and made the correct changes:
the ToolsVersion property must be changed from "4.0" to "12.0"
the MinimumVisualStudioVersion property must be changed from 11.0 to 12.0
two new properties are added, ApplicationType (Windows Store) and ApplicationTypeRevision (8.1)
every configuration's PlatformToolset property must be changed from v110 to v120
There is a log file in the Debug\projectname.tlog directory named link.read.1.tlog that contains diagnostics, it shows all the .lib files that the linker uses. It must contain this line:
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\VC\LIB\STORE\VCCORLIBD.LIB
Which is the .lib file that contains these symbols.

Codename one builds failing

I am trying to port my lwuit app to codenameone.
I have used a json package in the application. (org.json.me). This package is actually part of json jar and contains classes to manipulate json files.
The application was working fine when I used to make J2ME builds with LWUIT.
In the codename one emulator also, the application is working without any issues.
When I, try to send a J2ME build to the server by right clicking the project and selecting 'Send J2ME Build', my application's build process crashes with some warnings.
Executing: javac -source 1.2 -target 1.2 -classpath C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpclasses;C:\Users\Shai\Desktop\j2me\midpapis.jar -d C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpclasses C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpsrc\GREStub.java Executing: java -jar C:\Users\Shai\Desktop\j2me\proguard.jar -injars . -libraryjars C:\Users\Shai\Desktop\j2me\midpapis.jar -outjars C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\result\GRE.jar -target 1.3 -keep public class ** extends javax.microedition.midlet.MIDlet { public *; } -defaultpackage '' -printmapping C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\result\obfuscation_mapping.txt -overloadaggressively -dontusemixedcaseclassnames -useuniqueclassmembernames -dontoptimize ProGuard, version 4.7
Reading program directory [C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpclasses]
Reading library jar [C:\Users\Shai\Desktop\j2me\midpapis.jar]
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONException
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$9: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$9: can't find referenced class org.json.me.JSONObject
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.siemens.mp.game.Light
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.motorola.phonebook.PhoneBookRecord
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.nokia.mid.ui.FullCanvas
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class net.rim.device.api.system.Application
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.mot.iden.util.Base64
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class mmpp.media.MediaPlayer
Note: there were 6 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
Warning: there were 26 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Error: Please correct the above warnings first.
Now, i feel that the server is not finding my json package. But i need this build to succeed. I have used the classes of this jar a lot in my app. ANd now i don't want to migrate to the inbuilt json parser as I'll have to change my code a lot which I wish to strictly avoid.
1)What can I do to resolve this?
2)Can we not use third party jars in codename one?
You can't change library classpath in Codename One. Everything must be part of the source directories in order to work properly.
Codename One has its own JSON parser please read about it in the Codename One developer guide.

iphone, setting up application tests error _OBJC_CLASS_$_MyClass undefined symbols

I am trying to set up application tests for my iOS application. I am using the following article as the basis of what I am doing:
http://cocoawithlove.com/2009/12/sample-iphone-application-with-complete.html
So I can created the additional targets that I need. I now have 3 targets:
-The original target
-The tests target
-The duplicate target
I have added the original target as a target dependency to my test target. I have then added the test target as a target dependency on my duplicate target.
However, whenever I try to reference any of my classes in my test cases I get:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_MyClass", referenced from:
objc-class-ref in MyApplicationTests.o
"_OBJC_CLASS_$_AnotherClass", referenced from:
objc-class-ref in MyApplicationTests.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there another location which I need to set up some sort of dependency to tell my Tests target that it is dependant on the original target?
Cheers
So I found the solution to this issue at:
http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
You need to do the following to avoid this issue:
Go back to your app target (not the test target), set the Symbols Hidden by Default build setting to NO
Now there is no need to add any source files to the Compile Source for the test target as long as the original target is set as a dependency.
You have to include the .m file for any of your classes that you reference from your test code in the list of compiled sources for your test target. From the error message you provided, that sounds like your problem. In XCode 4.2 you can add a compile source to a target by selecting your project in the project navigator, then selecting your test target, the Build Phases tab, and expanding the Compile Sources section. Click the "+" below the Compile Sources section and then select your class' .m file.