New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net "standard" library referenced by an Android project fail after conversion from nuget -> paket #2800

Closed
7sharp9 opened this Issue Sep 28, 2017 · 23 comments

Comments

Projects
None yet
3 participants
@7sharp9
Member

7sharp9 commented Sep 28, 2017

Description

I have a .Net "standard" library referenced by a Android project, when the projects are converted to a paket solution I encounter a build failure.

Repro steps

I have a before paket conversion at https://github.com/7sharp9/androidTest and a paket branch https://github.com/7sharp9/androidTest/tree/paket after the conversion available. The nuget version build fine.

git clone https://github.com/7sharp9/androidTest -b paket
cd androidTest
dotnet build netstandardLib/netstandardLib.fsproj
msbuild androidTest/androidTest.fsproj

Expected behavior

Build works

Actual behavior

build fails with:

Build FAILED.

"/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj" (default target) (1) ->
(_ResolveAssemblies target) ->
  /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.Identity.Client, Version=1.1.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. Perhaps it doesn't exist in the Mono for Android profile? [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error : File name: 'Microsoft.Identity.Client.dll' [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00124] in <6a0245f99c1849bf83cb02ca9f84914e>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in <6a0245f99c1849bf83cb02ca9f84914e>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <52b04bb21b54415ab282c60622b3bc28>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0019c] in <52b04bb21b54415ab282c60622b3bc28>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
@7sharp9

This comment has been minimized.

Show comment
Hide comment
@7sharp9
Member

7sharp9 commented Sep 28, 2017

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member
  1. you didn't gitignore the paket-files folder. The cache file is commited. so subsequent restores think everything is already in place
Member

forki commented Sep 28, 2017

  1. you didn't gitignore the paket-files folder. The cache file is commited. so subsequent restores think everything is already in place
@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

(@matthid we should make convert somehow gitignore it!?)

Member

forki commented Sep 28, 2017

(@matthid we should make convert somehow gitignore it!?)

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

FileNotFoundException should be gone after nuking of paket-files folder and "paket restore"

Member

forki commented Sep 28, 2017

FileNotFoundException should be gone after nuking of paket-files folder and "paket restore"

@7sharp9

This comment has been minimized.

Show comment
Hide comment
@7sharp9

7sharp9 Sep 28, 2017

Member

After nuking that folder and paket restore its still the same

Member

7sharp9 commented Sep 28, 2017

After nuking that folder and paket restore its still the same

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

are you sure it's exactly the same message? because now the packages folder should exist

Member

forki commented Sep 28, 2017

are you sure it's exactly the same message? because now the packages folder should exist

@7sharp9

This comment has been minimized.

Show comment
Hide comment
@7sharp9

7sharp9 Sep 28, 2017

Member
"/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj" (default target) (1) ->
(_ResolveAssemblies target) ->
  /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.Identity.Client, Version=1.1.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. Perhaps it doesn't exist in the Mono for Android profile? [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error : File name: 'Microsoft.Identity.Client.dll' [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00124] in <6a0245f99c1849bf83cb02ca9f84914e>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in <6a0245f99c1849bf83cb02ca9f84914e>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <52b04bb21b54415ab282c60622b3bc28>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0019c] in <52b04bb21b54415ab282c60622b3bc28>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
Member

7sharp9 commented Sep 28, 2017

"/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj" (default target) (1) ->
(_ResolveAssemblies target) ->
  /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.Identity.Client, Version=1.1.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. Perhaps it doesn't exist in the Mono for Android profile? [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error : File name: 'Microsoft.Identity.Client.dll' [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00124] in <6a0245f99c1849bf83cb02ca9f84914e>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in <6a0245f99c1849bf83cb02ca9f84914e>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <52b04bb21b54415ab282c60622b3bc28>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1445,2): error :   at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0019c] in <52b04bb21b54415ab282c60622b3bc28>:0  [/Users/dave.thomas/Projects/androidTest/androidTest/androidTest.fsproj]
@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

TBH I have no idea what is happening. Do you see what is wrong in the fsproj?

Member

forki commented Sep 28, 2017

TBH I have no idea what is happening. Do you see what is wrong in the fsproj?

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

also it's weird that's importing NETStandard.Library.targets

why are you mixing old and new proj formats?

Member

forki commented Sep 28, 2017

also it's weird that's importing NETStandard.Library.targets

why are you mixing old and new proj formats?

@7sharp9

This comment has been minimized.

Show comment
Hide comment
@7sharp9

7sharp9 Sep 28, 2017

Member

Its just a new droid template from vs4mac, I can't tell whats wrong to be honest, I spent a good few hours yesterday trying to figure out whats going on then decided to file this small repo.

Member

7sharp9 commented Sep 28, 2017

Its just a new droid template from vs4mac, I can't tell whats wrong to be honest, I spent a good few hours yesterday trying to figure out whats going on then decided to file this small repo.

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

it is so weird. but will try to dig deeper

Member

forki commented Sep 28, 2017

it is so weird. but will try to dig deeper

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

one thing that is not ok is: you did not set TargetFrameworkIdentifier

Member

forki commented Sep 28, 2017

one thing that is not ok is: you did not set TargetFrameworkIdentifier

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

and it looks like your TargetFrameworkVersion is 8 - which don't know yet in paket

Member

forki commented Sep 28, 2017

and it looks like your TargetFrameworkVersion is 8 - which don't know yet in paket

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

let's try something:

<When Condition="$(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1')">
  <ItemGroup>
    <Reference Include="Microsoft.Identity.Client">
      <HintPath>..\packages\Microsoft.Identity.Client\lib\monoandroid70\Microsoft.Identity.Client.dll</HintPath>
      <Private>True</Private>
      <Paket>True</Paket>
    </Reference>
  </ItemGroup>
</When>

please set targetframework to MonoAndroid and manually add the 8.0 in that condition.

would that help?

Member

forki commented Sep 28, 2017

let's try something:

<When Condition="$(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1')">
  <ItemGroup>
    <Reference Include="Microsoft.Identity.Client">
      <HintPath>..\packages\Microsoft.Identity.Client\lib\monoandroid70\Microsoft.Identity.Client.dll</HintPath>
      <Private>True</Private>
      <Paket>True</Paket>
    </Reference>
  </ItemGroup>
</When>

please set targetframework to MonoAndroid and manually add the 8.0 in that condition.

would that help?

@matthid

This comment has been minimized.

Show comment
Hide comment
@matthid

matthid Sep 28, 2017

Member

(@matthid we should make convert somehow gitignore it!?)

We could move it to the .paket folder or somewhere where stuff is gitignored anyway?

Member

matthid commented Sep 28, 2017

(@matthid we should make convert somehow gitignore it!?)

We could move it to the .paket folder or somewhere where stuff is gitignored anyway?

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

.paket is not gitignored everywhere

Member

forki commented Sep 28, 2017

.paket is not gitignored everywhere

@7sharp9

This comment has been minimized.

Show comment
Hide comment
@7sharp9

7sharp9 Sep 28, 2017

Member

Xamarin abuse the TargetFrameworkVersion to represent the Android version, 8 is the latest one. I can drop it to 7.1

Member

7sharp9 commented Sep 28, 2017

Xamarin abuse the TargetFrameworkVersion to represent the Android version, 8 is the latest one. I can drop it to 7.1

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

still you need to set MonoAndroid to activate the case

Member

forki commented Sep 28, 2017

still you need to set MonoAndroid to activate the case

@7sharp9

This comment has been minimized.

Show comment
Hide comment
@7sharp9

7sharp9 Sep 28, 2017

Member

note: this was the out of the box template for droid I didn't add or remove anything

Member

7sharp9 commented Sep 28, 2017

note: this was the out of the box template for droid I didn't add or remove anything

@7sharp9

This comment has been minimized.

Show comment
Hide comment
@7sharp9

7sharp9 Sep 28, 2017

Member

TargetFrameworkIdentifier along with TargetFrameworkVersion dropped to 7.1 is making things build, hard to decipher the errors in msbuild, especially as they look to be coming form Mono.Cecil

Member

7sharp9 commented Sep 28, 2017

TargetFrameworkIdentifier along with TargetFrameworkVersion dropped to 7.1 is making things build, hard to decipher the errors in msbuild, especially as they look to be coming form Mono.Cecil

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 28, 2017

Member

ok. good. so we need to add the 8.o to our moniker collection. will do tomorrow.

Member

forki commented Sep 28, 2017

ok. good. so we need to add the 8.o to our moniker collection. will do tomorrow.

@forki

This comment has been minimized.

Show comment
Hide comment
@forki
Member

forki commented Sep 29, 2017

image

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Sep 29, 2017

Member

5.100.3 will add this automatically. You still need to set TargetFrameworkIdentifier

Member

forki commented Sep 29, 2017

5.100.3 will add this automatically. You still need to set TargetFrameworkIdentifier

@forki forki closed this in cdcc2e1 Sep 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment