Is it possible to install Autofac 4.0 for UAP?
Belorus opened this issue · 13 comments
Default project.json looks like that:
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}
During installation of package via nuget i see many errors like this:
Restoring packages for \App2\project.json...
Version conflict detected for System.Diagnostics.Debug.
App2 (≥ 1.0.0) -> Autofac (≥ 4.0.0-rc1-177) -> System.Diagnostics.Debug (≥ 4.0.11-beta-23516)
App2 (≥ 1.0.0) -> Microsoft.NETCore.UniversalWindowsPlatform (≥ 5.0.0) -> Microsoft.NETCore.Runtime (≥ 1.0.0) -> Microsoft.NETCore.Runtime.CoreCLR-arm (≥ 1.0.0) -> System.Diagnostics.Debug (= 4.0.10).
http://stackoverflow.com/questions/33855314/how-can-i-update-one-specific-dotnet-assembly-in-universal-windows-platform-app/33902742#33902742 - this can help a bit during resolving dependencies conflict between UAP and Autofac
If i add beta runtime dependency i get following:
All packages are compatible with UAP,Version=v10.0.
System.Linq.Expressions 4.0.11-beta-23516 provides a compile-time reference assembly for System.Linq.Expressions on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86.
Some packages are not compatible with UAP,Version=v10.0 (win10-x86).
System.Linq.Expressions 4.0.11-beta-23516 provides a compile-time reference assembly for System.Linq.Expressions on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot.
Some packages are not compatible with UAP,Version=v10.0 (win10-x86-aot).
Package restore failed for 'AutofacUWP'.
Any change in the situation with Visual Studio 2015 Update 1?
Upd1 didn't change anything.
But i've found a workaround.
- Install Microsoft.NETCore.Runtime 1.0.1-beta-23516 via nuget.
- Install System.Linq.Expressions 4.0.11-beta-23516
- Install Autofac 4.0.0-rc1-177
Actually Autofac shouldn't be referencing those new package versions. System.Linq.Expressions 4.0.11-beta-23516 has no API changes over System.Linq.Expressions 4.0.10. Why reference the latest version?
Given we've got a bunch of package compatibility stuff we're already fighting through with the dotnet
/ netstandard
TFM changes and portable class libraries, this pretty heavily overlaps with the discussion going on in #594, where we're tracking the overall conversion effort.
I'll leave this open to ensure we remember to test specifically on UAP, but it may be worth following that issue since we'll probably update things more often over there.
I'm also getting this.
Severity Code Description Project File Line Suppression State
Error System.Linq.Expressions 4.0.11-beta-23516 provides a compile-time reference assembly for System.Linq.Expressions on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot. 0
Which is a problem because I'd like to update to 4.0 to fix CA errors #663
@JamesNK can you share your project.lock.json? It seems like the runtime-linkage isn't happening. System.Linq.Expressions AOT implementation exists in runtime.aot.System.Linq.Expressions. So long as our runtime ID graph and lineup are part of your package closure (Microsoft.NETCore.Platforms) it should bring in the aot implementation.
I rolled back the System.Linq.Expressions
dependency in the develop
branch to 4.0.10 to see if that helps. It's published to the MyGet feed (https://www.myget.org/F/autofac/api/v3/index.json
) as v4.0.0-rc2-185. Let me know if that helps. I tested it quickly myself as such and things build with no errors or warnings:
{
"dependencies": {
"Autofac": "4.0.0-rc2-185",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23516",
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
"System.Collections": "4.0.11-beta-23516"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}
This project I'm using Autofac with has a lot of developers and I don't want to add non-standard feeds into the mix. I'll wait until it is on nuget.org
Is it possible for you to try it just temporarily so I can verify it's not "works on my machine?" If it works for you, I'll close the issue as fixed.
It compiles. Ironically Code Analysis doesn't work anymore which is the reason I wanted to upgrade in the first place.
18>MSBUILD : error : CA0055 : Could not identify platform for 'Tests.exe'.
18>MSBUILD : error : CA0052 : No targets were selected.
Thanks for checking it out. I think I'll call this closed for now, but if you find this doesn't go away after all the tooling catches up to the name changes and everything else, we can revisit.