Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to upgrade 4.1.0 however 4.0.0 works fine #312

Closed
Dipannita20 opened this issue Jun 30, 2022 · 7 comments · Fixed by #317
Closed

Unable to upgrade 4.1.0 however 4.0.0 works fine #312

Dipannita20 opened this issue Jun 30, 2022 · 7 comments · Fixed by #317

Comments

@Dipannita20
Copy link

Description:

(your description here)

Environment

Visual Studio 2019 Professional windows

Steps to Reproduce Issue:

  1. Right click Manage Nuget Packages for Solution
  2. Browse OneSignalSDK.Xamarin select any project share, android, iOS and 4.1.0
  3. Click install

Package not installing getting below error, attached exception

Anything else:

onesignal_4.1.0_upgrade_exception.txt
n here)

@ChrisMonson
Copy link

ChrisMonson commented Jun 30, 2022

Just adding a little bit of additional troubleshooting information on this one as I ran into this a couple days ago. I believe this is happening because the directory structure after extracting the files from the nuget package winds up with file paths that exceed 260 characters which is the default maximum in Windows. This causes the files to not actually get created thus resulting in the "Could not find a part of the path" error you are getting. If you look in the location listed, the folder will contain files with shorter filenames but will be missing the file referenced and probably several others.

I was able to work around this by moving my project closer to the drive's root directory, deleting the OneSignal package from the packages folder, and restoring the package. Since the paths will be shorter at this point, it all worked properly.

This only affects Windows, as the max path length on Mac is much longer.

@Dipannita20
Copy link
Author

I have moved my project to closer to drive root directory
Deleted OneSignal Package from packages folder
But as I am trying to install OneSignalSDK.Xamarin, it is getting installed in C:\Users\dipannitad.nuget\packages.
I have verified as you have mentioned other files are present only OneSignalNotificationServiceExtensionHandler.h file is missing.

"deleting the OneSignal package from the packages folder, and restoring the package"
Could you please provide me exact steps, it will be really helpful

Thank you

@ChrisMonson
Copy link

Ahh, I forgot about that step. I wound up having to go in and remove the OneSignalSDK.Xamarin package from the global NuGet package folder on my computer as well. The file path length issue is unfortunately an issue there as well. I just went to the folder you listed above, found the OneSignalSDK.Xamarin folder and removed it. There is probably a better way to go about that, but that worked for me.

As for steps, I closed Visual Studio, removed the package, and then restarted Visual Studio. Visual Studio automatically restored the package to the project's packages directory with the shorter directory path and it worked properly after that.

This isn't really a good long term solution to this problem, and I'm sure there is probably a much better way to do this through the NuGet CLI, but these steps did work for me.

@developer9969
Copy link

I Have the same issue - and I could not upgrade to 4.10 to see if some other issues that exists on 4.0.0 were fixed.

What changed between 4.0.0 and 4.10 @jkasten2

thanks

@Dipannita20
Copy link
Author

Dipannita20 commented Jul 4, 2022

This is how I have solved.
Change default nuget package installation path:
Go to C:\Users\xxxxx\AppData\Roaming\NuGet - open nuget.config ->
then add below inside <configuration>, value here can be anything set to close to drive root

<config>
	<add key="globalPackagesFolder" value="D:\nuget" />
   </config>

OR
you can create nuget.config to your project solution folder, where .sln file is present
and add

<configuration>
<config>
	<add key="globalPackagesFolder" value="E:\nuget" />
   </config>
</configuration>

Then do nuget restore, it basically install all the nuget packges to new location. now install OneSignalSDK.Xamarin
as the path become short, it will get install.

Thanks @ChrisMonson for helping me out

@developer9969
Copy link

developer9969 commented Jul 4, 2022

@Dipannita20 thank you for your time and reply.
I have already a solution nuget config as follows:

`

	<configuration>
	  <config>
		<clear />
		<add key="repositoryPath" value="packages" />
	  </config>
	  <packageSources>
		<clear />
		<add key="Nuget.org" value="https://api.nuget.org/v3/index.json" />
	  </packageSources>
	  <activePackageSource>
		<add key="All" value="(Aggregate source)" />
	  </activePackageSource>
	</configuration>`

I have added

  1. ` <add key="globalPackagesFolder" value="C:\Nuget" />   `
    
  2. Right clicked solution and did restore packages -  tried command line too 
    
  3. Nothing changed as the path did not take effect.
    

Missing the obvious?
thanks

@developer9969
Copy link

@Dipannita20 yep managed to make it work as you suggested - now 4.1.0 installs however I still get

Severity Code Description Project File Line Suppression State
Error Unable to copy file "
C:\Nuget\onesignalsdk.xamarin\4.1.0\build\Xamarin.iOS....\content\OneSignalSDK.Xamarin.iOS.resources\OneSignalCore.xcframework\ios-arm64_x86_64-maccatalyst\OneSignalCore.framework\Versions\A\Headers\OSPrivacyConsentController.h"
to "PathToMyApp.iOS\bin\iPhoneSimulator\Debug/OneSignalSDK.Xamarin.iOS.resources/OneSignalCore.xcframework\ios-arm64_x86_64-maccatalyst\OneSignalCore.framework\Versions\A\Headers\OSPrivacyConsentController.h".
Could not find a part of the path 'c:\PathToMyApp.iOS\bin\iPhoneSimulator\Debug/OneSignalSDK.Xamarin.iOS.resources/OneSignalCore.xcframework\ios-arm64_x86_64-maccatalyst\OneSignalCore.framework\Versions\A\Headers\OSPrivacyConsentController.h'.
MyApp.iOS

and I dont get that at all with V3 or V4.0..

Any ideas anyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants