Real-Serious-Games / C-Sharp-Promise

Promises library for C# for management of asynchronous operations.
MIT License
1.2k stars 149 forks source link

Can't install with Unity v5.2.1f #8

Closed katopz closed 8 years ago

katopz commented 9 years ago

Hi guys,

I trying to install with Unity v5.2.1f 64bit via nuget and got this error

PM> Install-Package RSG.Promise
Attempting to gather dependencies information for package 'RSG.Promise.1.1.6' with respect to project 'sk2-btf.CSharp', targeting '.NETFramework,Version=v3.5,Profile=Unity Subset v3.5'
Attempting to resolve dependencies for package 'RSG.Promise.1.1.6' with DependencyBehavior 'Lowest'
Resolving actions to install package 'RSG.Promise.1.1.6'
Resolved actions to install package 'RSG.Promise.1.1.6'
Install failed. Rolling back...
Package 'RSG.Promise 1.1.6' does not exist in project 'sk2-btf.CSharp'
Package 'RSG.Promise 1.1.6' does not exist in folder 'D:\bit\sk2-unity3d\src\sk2-btf\packages'
Install-Package : Could not install package 'RSG.Promise 1.1.6'. You are trying to install this 
package into a project that targets '.NETFramework,Version=v3.5,Profile=Unity Subset v3.5', but the 
package does not contain any assembly references or content files that are compatible with that 
framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package RSG.Promise
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets 
   .InstallPackageCommand

PM> 

Any hint to make it work please?

Thanks

ashleydavis commented 9 years ago

How did you create the solution/project that you are installing it into?

katopz commented 9 years ago

@ashleydavis I create new one from unity, for now I use source code instead and it's working fine.

ashleydavis commented 9 years ago

I've tried one way of installing the promises library using nuget, it works to a point. Then Unity stomps on it.

Create a new Unity project. Using Unity add a new C# script (you need to do this so Unity can generate the project for Visual Studio). Then use "Open C# Project' from Unity's Assets menu. Now right cilck on the solution and select "Manage NuGet Package for Solution". You can now search for and install the promises library. This sets up the reference correctly in the project.

Unfortunately when you use Unity to add a new script it regenerates your project. Which strips out the reference because the Promises dll isn't in Unity's Assets directory. NuGet installs the dll to the 'packages' directory which is above 'Assets'.

This might be a solution though if we can figure out how to get NuGet to install the dll under the Assets directory.

ashleydavis commented 9 years ago

I tried the following:

PM> Install-Package RSG.Promise
Attempting to gather dependencies information for package 'RSG.Promise.1.1.6' with respect to project 'Assembly-CSharp', targeting '.NETFramework,Version=v3.5'
Attempting to resolve dependencies for package 'RSG.Promise.1.1.6' with DependencyBehavior 'Lowest'
Resolving actions to install package 'RSG.Promise.1.1.6'
Resolved actions to install package 'RSG.Promise.1.1.6'
Adding package 'RSG.Promise.1.1.6' to folder 'C:\temp\unity51_promises_test2\packages'
Added package 'RSG.Promise.1.1.6' to folder 'C:\temp\unity51_promises_test2\packages'
Added package 'RSG.Promise.1.1.6' to 'packages.config'
Successfully installed 'RSG.Promise 1.1.6' to Assembly-CSharp

This works fine for me in Visual Studio 2015.

Although it suffers the same problem as in the previous comment. When Unity regenerates the project it strips out the promises dll.

ashleydavis commented 9 years ago

Which version of Visual Studio are you using?

ashleydavis commented 9 years ago

Normally we just copy the Promises dll into our Unity projects. I really want to find a way to make nuget work with Unity though so I'll keep looking into it.

katopz commented 9 years ago

Thanks @ashleydavis I'm using VS2015, and in case it's unity issue,I think you can close this issue if you want to and mention this in readme would be nice.

BTW, do you provide .dll somewhere? would be nice if you've one.

Cheers

ashleydavis commented 9 years ago

I think I have figured out a way around this. I'll just need some time to write it up.

taylank commented 9 years ago

Having the same problem here. Couldn't make nuget work.

ashleydavis commented 9 years ago

Are you able to create a sample Unity project to share with me? Then I can try installing via nuget and see if I get the same problem as you.

katopz commented 9 years ago

Here's my blank project by...

And failed to install after that, also via NuGet console.

Thanks

BraveSirAndrew commented 9 years ago

You could move to paket which sits on top of nuget and then also use unity3d.paket from wooga. That installs your dependencies into the assets folder for you, which means your vs solution will also have the references added automatically by unity, and paket just seems generally to be an improvement over nuget anyway, so worth looking at.

ashleydavis commented 8 years ago

I've written a blog post on using Unity and NuGet. Please let me know if this helps.

http://www.what-could-possibly-go-wrong.com/unity-and-nuget/