Repository navigation
Description
Description
I am trying to substitute NuGet with Paket for managing my Unity3D dependencies. Unity3D requires custom target framework names:
- net35-unity micro v3.5
- net35-unity subset v3.5
- net35-unity full v3.5
- net35-unity web v3.5
In addition, paket fails to parse any of the above when using framework: net35-unity subset v3.5 or any of the other alternatives when specified in the paket.dependencies file.
Repro steps
- Use a nuget repository in your paket.dependencies file
- Refer to a nuget package which has any of the following target frameworks:
- net35-unity micro v3.5
- net35-unity subset v3.5
- net35-unity full v3.5
- net35-unity web v3.5
- List the package in paket.references file
- Execute paket.exe update or paket.exe install
Expected behavior
NuGet works fine with these framework versions, I was hoping Paket will manage them too.
Actual behavior
An exception is thrown
Paket failed with:
Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown.
StackTrace:
at Microsoft.FSharp.Collections.ListModule.Pick[T,TResult](FSharpFunc`2 chooser, FSharpList`1 list) at Paket.ProjectFileModule.getTargetFramework(ProjectFile project) at [email protected](KeyValuePair`2 kv) at [email protected](b& ) at Microsoft.FSharp.Collections.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext() at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc`2 action, IEnumerable`1 source) at Paket.InstallProcess.InstallIntoProjects[a](InstallerOptions options, Boolean forceTouch, DependenciesFile dependenciesFile, LockFile lockFile, FSharpList`1 projectsAndReferences, FSharpMap`2 updatedGroups) at Paket.UpdateProcess.SmartInstall(DependenciesFile dependenciesFile, UpdateMode updateMode, UpdaterOptions options) at <StartupCode$Paket-Core>[email protected](Unit unitVar0) at Paket.Utils.RunInLockedAccessMode[a](String rootFolder, FSharpFunc`2 action) at [email protected](ParseResults`1 results) at Paket.Program.processWithValidation[T](Boolean silent, FSharpFunc`2 validateF, FSharpFunc`2 commandF, ParseResults`1 result) at Paket.Program.main$cont@400(ParseResults`1 results, Boolean silent, Boolean fromBootstrapper, Unit unitVar) at Paket.Program.main()
Known workarounds
It seems the dependencies are being downloaded and stored in the packages directory regardless of their target framework version. So a possible workaround could be:
- Empty your
paket.referencesfile, or exclude these dependencies which have the exotic target framework - Manually copy the package content, or perform the paket install/update operation from a shell script, then use shell script commands to copy or rsync the contents of the bad packages to the project from inside the shell script. Here is an example shell script I am currently using:
PAKET='../.paket/paket.exe'
if [ ! -f $PAKET ]; then
eval "${PAKET%.exe}.bootstrapper.exe"
fi
$PAKET install -v
for package in $(ls packages); do
cp -rfv packages/$package/content/** `pwd`/
done
NB! In case an affected package is updated with items removed in the new version, the above script will fail to remove them from the destination project. In addition, code dependencies (dlls) have to manually be added to the project references.
Activity
[-]Custom target frameworks cause KeyNotFoundException[/-][+]Unity3D target frameworks cause KeyNotFoundException[/+]stackh34p commentedon Apr 24, 2017
The issue seems not to present a widely-desired feature in Paket. Also, future support for .netstandard in Unity is something that is actively being worked on, and that eventually will render this feature obsolete anyway.
For those of you still interested in supporting the older Unity projects, you can checkout and build this branch from my fork of Paket.
forki commentedon Apr 24, 2017
Did you submit a PR? maybe your stuff could have been integrated!?
stackh34p commentedon Apr 24, 2017
Hello @forki , I did, but it was kind of rejected due to the reasons I mentioned here. I could reopen it if you desire, but as I wrote in the PR itself, I am new to F# and I am not really confident in my changes being the best for the case.
Tests are passing though, but only the appveyor build succeeded. If you believe the effort of merging this is worth it I could resubmit it again. So far I have interest in supporting my own branch and I will try to keep it regulary up to date with mainstream.