-
Notifications
You must be signed in to change notification settings - Fork 269
project.json and AnyCPU Classic Desktop projects #904
Description
I was playing around with the Microsoft.Data.Sqlite package after this pull request: aspnet/Microsoft.Data.Sqlite#100
The nupkg looks something like tihs:
- Microsoft.Data.Sqlite
- lib
- dotnet
- Microsoft.Data.Sqlite.dll
- dotnet
- runtimes
- win
- native
- x86
- sqlite3.dll
- x64
- sqlite3.dll
- x86
- native
- (other RIDs)
- win
- lib
I was trying to consume the package in a Full .NET AnyCPU project. (e.g. a WPF, WinForms, or Console app)
In theory, both the x86 and x64 directories (i.e. everything under runtimes/win/native) should be copied to the bin folder. The managed library could then call LoadLibrary(Path.Combine(bin, arch, "sqlite3.dll")); to load the appropriate library. Unfortunately, the directory structure isn't preserved. Both dlls are copied directly into the bin folder--one over top of the other.
I created a new Console app, added a project.json, and tried to install the package, but it gave the following error. It looks like instead of just using win for AnyCPU projects, it's trying to use win-anycpu.
C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(76,5): error : Couldn't find the required information in the lock file. Make sure you have .NETFramework,Version=v4.6/win-anycpu mentioned in your targets.
I was able to resolve this using the following project.json file.
{
"frameworks": {
"net46": { }
},
"runtimes": {
"win": { },
"win-anycpu": {
"#import": [ "win" ]
}
},
"dependencies": {
"Microsoft.Data.Sqlite": "1.0.0-*"
}
}/cc @rowanmiller @divega