Nuget Restore not installing content files - nuget-package-restore

So it appears that when installing a Nuget package that contains additional "non-assembly" files, those files are usually copied to the appropriate locations via a PowerShell script (install.ps1). And this works all well and good, until you check your project into source control; having ignored the packages folder (cause well that's the point right...), and someone else pulls the project. In that case, when that person restores the packages, those "non-assembly" files are not re-installed, despite being copying back down to the packages folder the PowerShell script doesn't run on restore. Forcing that person to determine which packages need to be literally uninstalled and reinstalled to get things working again.
Am I missing something? shouldn't that install script just run every time... I spent several hours today trying to determine why a colleague could not get their project running after pulling it out of source control for the first time.
Is there any work-around or fix for this besides creating yet another script to check for these missing files and:
Update-Package -Id packagename -reinstall
every single offending package, and run that as a pre-build event, just to get things working.

Related

Sublime Text 3 overwrites manually installed package in OSX

Following instructions to manually install arduino IDE here
Reason for manual installation is because package manager has an older version of the plugin (10 months).
After placing it in ../Packages, I open ST3 and watch Finder. Initially, the folder extracted is named "Stino-new-stino". A folder is created at ../Packages/User/Stino with what seems to be options for the topmenu, and then the Stino-new-stino folder is deleted.
Tried to put extracted folder into ../Installed Packages, as well as ../Packages/User, but doesn't get detected.
Also noticed that my TomorrowTheme package got moved into my ../Packages/User/SublimeLinter.
I removed SublimeLinter and it still seems to be happening so I'm thinking it's an ST3 thing.
There was some funky beta code happening and had to remove package-metadata.json for it to stop deleting itself.

install chocolatey redis packages for VisualStudio on build

When we download git project and click build button in VS, it restores nuget packages and then compile. always cool.
Just like that, I'd like to install Redis locally before compile because my project unit test job requires Redis.
I found Redis-64 in nuget but I don't know why it does not install properly. It displays "Redis-64 is already installed" but it's not.
There is Chocolately nuget package and Redis for chocolatey. It looks promising to utilize them.
To achieve my goal, it would be required to (1) check installation of chocolately first, and then (2) download redis-64, and then (3) execute redis-server.exe before compile process (could be placed at the Pre-build event command in .csproj property).
I want to know how to check Redis chocolatey installation and rest of other steps in VS. Would you please teach me how to achieve to do that?
I could be way off the mark here, but the redis package that you are referring to, i.e. from NuGet should only include the assemblies that you could then consume within your application. If you actually want to have the Redis application installed, you would want to install the Redis application from Chocolatey.org, which you can find here.
In terms of getting Chocolatey etc installed as part of your build process, you might want to take a look at the build script for ChocolateGUI. As part of it's build, which is executed on AppVeyor, it checks for Chocolatey, and if it isn't there, installs it, and all required applications.
For what you want, I think you need to include:
choco install redis
Within your build script, and this will give you the redis-server.exe that you are looking for.
I installed the redis-64 NuGet package and it just worked for me. It is an unusual package in that it doesn't associate itself with any Visual Studio project, but rather it is referenced from a solution-level packages.config.
To use the Redis server in my integration test, I start the server with this code:
Process.Start(new ProcessStartInfo(Path.Combine(Directory.GetDirectories(#"..\..\..\packages", "Redis-64.*").Single(), "redis-server.exe"), "--bind 127.0.0.1") {
WindowStyle = ProcessWindowStyle.Hidden
});

Crashlytics file not found

Recently opened a project that I had compiled and submitted to Apple.
I haven't touched it for a couple of months but I'm getting this odd compile error at:
#import <Crashlytics/Crashlytics.h>
The error reads:
'Crashlytics/Crashlytics.h' file not found
Clearly the framework can't be found but I'm puzzled as to why, when the project was working a few months ago, it's suddenly stopped.
Any suggestions why?
Xcode: 4.6.3
Mac OS X: 10.8.4
Just add $(SRCROOT) to the Framework Search Paths in Project Build Settings (Search Paths).
Crashlytics installation process drops its Crashlytics.framework to your project folder (or creates the symlink).
If you moved Crashlytics.framework somewhere deeper in the project folder hierarchy - set 'recursive' to the right or just point directly to its parent folder in Header Search Paths:
$(SRCROOT)/Path/to/the/folder/containing/Crashlytics.framework
Delete frameworks from you project and disk. Check that you have the newest version of Fabric plugin.
Copy frameworks from plugin folder to desktop with this commands:
ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/com.twitter.crashlytics.ios-default.zip ~/Desktop/
ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/io.fabric.sdk.ios-default.zip ~/Desktop/
Add frameworks from desktop to your project.
Info from: https://twittercommunity.com/t/error-upgrading-from-crashlytics-on-ios/36196/2
I'd recommend just using CocoaPods to add the Crashlytics framework. No need to care about paths anymore.
Podfile:
pod 'Crashlytics', '~> 3.4.1'
Script Build Phase for dSYM Upload:
./Pods/Crashlytics/iOS/Crashlytics.framework/run <your_crashlytics_id>
Import:
#import <Crashlytics/Crashlytics.h>
For me, this worked:
Remove the fabric and crashlytics frameworks from your project, and delete the files from the disk for our project.
Comment the lines in your appdelegate.m file, if you added them for the following:
import Fabric/Fabric.h
import Crashlytics/Crashlytics.h
and
[Fabric with:#[CrashlyticsKit]];
In the fabric app, choose "New app", and select your Xcode project file
Recopy the build script and build as instructed. The build step is why you needed to comment the lines above-- it won't work if you leave those lines in.
After the build script runs, it will prompt you to drag the frameworks from the app window into your project navigator. This will copy the latest versions of he frameworks (which include the .h files) into your project
I have tried manually downloading, and copying from other projects, but this is the only way I could recover after losing the frameworks files for an app.
In my case, the Framework was in the project folder, but not in the Project Navigator. I dragged it to the project and everything worked fine.
I've had this issue working with distributed teams (through github) after checking in then checking out Crashlytics. The Crashlytics.framework will only have one folder inside it -- "Versions". You need to save a version of the contents inside Crashlytics.framework to another location, then copy-paste them into Crashlytics.framework later.
Remove Crashlytics.framework from the project and disk. Copy and add it again. It helped me.
In my case, I was migrating from an old Crashlytics install through the Mac app to Cocoapods. A lot of the answers to this question recommend completely removing everything and starting over. I started doing this and noticed a discrepancy between code found in Fabric's documentation and the code shown in the Fabric app during the step where it tells you what to copy into your Run Script Build Phase.
Fabric's documentation has double quotes surrounding the entire string: "${PODS_ROOT}/Fabric/Fabric.framework/run <Your_API_Key> <Your_Build_Secret>"
The Fabric App only had double quotes around the path to the run executable: "${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>
So before you delete everything and start over, try updating your Run Script Build Phase to this:
"${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>
I have changed the name of the working folder and Craslytics fails. Check this in Build Settings (Search Paths).
Good luck!
I have tried to play with the frameworks search path and relocating & reconnecting the framework file; checked the build settings (Link binary with libraries section) but the error persisted.
Finally, I have reinstalled the framework, which only takes 2-3 minutes. The problem might be caused by that you have relocated the Crashlytics.framework to another subfolder from the root directory, but I am not sure about the exact reason.
Delete everything regarding to the Crashlytics
Start crashlytics app, login and select your project
Add run script
Drag & drop the .framework file (I have kept it in the root folder)
Add the import and startWithAPIKey statements back
Completely Remove the Crashlytics Frameworks on your proj include the shell script in App Build Phases Run Script.
Reinstall the Fabric follow the guide,everything will be OK.
I had previously upgraded to Fabric and had no issues. A couple of days later, I reopened the same project and had the missing crashlytics.h file problem.
I couldn't simply reinstall from the plugin due to a non compiling project (I had so many CLS_LOG messages and references to the missing crashlytics.h file in my project, it would have taken a long time to remove them just to allow the build to work - refactor wouldn't work on CLS_LOG).
So instead, I deleted the crashlytics.framework from my project and did the following to reinstate it from the plug in directly:
Download the Fabric plugin again and double click the zip file to unpack the Fabric application.
Right click the Fabric icon and "Show Package Contents"
Copy the Crashlytics.framework folder to your Desktop and then re-add it to your project via File -> Add Files to ....
If step 3 doesn't work for you, you can also add crashlytics.framework to your project folder on your computer directly, and then also add it into your project list via Xcode same as in step 3 but uncheck "Copy Items if Needed" as you already put the files there yourself.
My project then compiled and worked fine again.
In terms of a guess as to why the file went missing? Part of the upgrade process got me to delete the old frameworks and then run the scripts etc. from the plugin. I think what happened is later when I emptied my trash, that some references were lost. I also had the problem where I'd put Crashlytics into my .gitignore file so it disappeared out of ALL my projects every committed which wasn't great.
Hope this helps someone!
I have same error.
Please try pod update
and fix it.
If FirebaseCrashlytics 9.0.0 installed , problem will be fixed.
stalling FirebaseCoreDiagnostics 9.0.0 (was 8.9.0)
Installing FirebaseCoreExtension (9.0.0)
Installing FirebaseCoreInternal (9.0.0)
//hrer
Installing FirebaseCrashlytics 9.0.0 (was 8.9.0)
Installing FirebaseFirestore 9.0.0 (was 8.9.1)
Installing FirebaseInstallations 9.0.0 (was 8.9.0)

Nuget Clean Package Remove/Install

I'd like to remove an entire nuget package, and cleanly install it in my project again.
Sadly, for some reason it skips removing files that have been "modified", and then skips putting them in the project on reinstall, because they already exist.
Is there any flag i can set to unconditionally remove every single trace of a nuget package, alternatively overwrite all existing files?
Thanks.
Unfortunately at the moment, NuGet does not do what you want. During the uninstall process, NuGet will only delete content files if they have not been modified. And as you've noticed, the update process will not update files that were modified either.
The Uninstall-Package command does have a -Force option, but that is to "force" uninstall even if there are other packages that depend on this one.
We can certainly file this as an issue and perhaps incorporate it into a future version.
Another option would be to create a PowerShell script that will enumerate a package's contents, then allow you to delete all the content files. I'll see if there is a simple way to do this.
BTW: Perhaps you can figure out a better way to extend the existing content file other than modifying it directly. Especially since you're losing your changes when the package is updated.
You can now do what you want! (finally)
You need to first update to the latest NuGet (I think this feature was added around April 2013). Do this by going to Tools > Extensions and Updates and click on Updates to update nuget.
Then the -FileConflictAction parameter will allow you to overwrite files.
Install-Package Microsoft.jQuery.Unobtrusive.Validation -Version 2.0.30506.0 -FileConflictAction Overwrite
(PowerShell Command Reference for Install-Package)
The NuGet Version 1.6 HAS a remove package function!
http://docs.nuget.org/docs/release-notes/nuget-1.6
if the update of the extension fails (signatur missmatch), just uninstall and reinstall. this is a known problem.
I think this happened to me a few times. Go to the packages.config file that should be the root directory of your project and remove the insurgent (in your case the line with the package: SignalR). This will tell NuGet that the package was never installed.
Now you will be able to reinstall it through the repository, then uninstall it so everything is back to the way it was before you got into this mess. I am unsure how it is occurring.

Deleting old file versions during an upgrade install

I am working with a pure InstallScript installation in InstallShield Pro 2010.
A third-party jar file has been replaced with a newer version in our software. When an upgrade installation is run, the new jar is installed, but the old jar also remains. Bad Things ensue.
How can I get InstallShield to update the contents of a folder, AND delete any other files in that location that are not included in the current version?
I've looked at the Component -> Overwrite options, but this only seems to apply "when the installer encounters an existing file with the same name as the one being installed".
Also, I realize that I could add something to the scripts to remove the offending file, but I need a scalable solution. There will be other files replaced over time, and I'd rather not have to manually add a fix to the installer every time this happens.
Can you just not change the name of the JAR file from build to build?
I'm not aware of InstallScript having a robocopy /mirror style copy. You'd have to script this behavior and I could see it not ending well quickly.

Resources