Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

VerifyVersionsTask fails when using neither packages.config nor PackageReference #176

Open
TimLariviere opened this issue Jun 10, 2019 · 11 comments

Comments

@TimLariviere
Copy link

TimLariviere commented Jun 10, 2019

Xamarin.Android Version (eg: 6.0):

9.0

Operating System & Version (eg: Mac OSX 10.11):

macOS Mojave 10.14.5

Support Libraries Version (eg: 23.3.0):

28.0.0.1

Describe your Issue:

Referencing Xamarin.Android.Support.Annotations.targets in a project that doesn't use neither packages.config nor PackageReference (but uses an external package manager such as Paket) fails on the VerifyVersionsTask.

It expects to find obj/project.assets.json which doesn't exist.

I think the issue is due to this if statement that has only 2 cases.

if (File.Exists(Path.Combine(ProjectPath.ItemSpec, "packages.config")))
{
Log.LogMessage("PackageReferenceType: packages.config");
NugetPackages.GatherPackagesConfigVersions(PACKAGE_ID_PREFIX, ProjectPath.ItemSpec, ExcludedPackages, packageVersions);
}
else
{
Log.LogMessage("PackageReferenceType: PackageReference");
NugetPackages.GatherProjectJsonVersions(PACKAGE_ID_PREFIX, ProjectExtensionsPath.ItemSpec, ExcludedPackages, frameworkVersion, packageVersions, Log);
}

Steps to Reproduce (with link to sample solution if possible):

  1. Create a C# Xamarin.Android project (from the templates of VS Mac)
  2. Remove the packages.config file or the PackageReference nodes from the csproj
  3. Manually reference the packages including Xamarin.Android.Support.Annotations (or use Paket for that)
  4. Make sure the targets file is imported in the csproj
<Import Project="..\packages\Xamarin.Android.Support.Annotations\build\monoandroid90\Xamarin.Android.Support.Annotations.targets" />
  1. Build the project

Other reproduction:

  1. Clone https://github.com/TimLariviere/XFIssueRepros/tree/master/SupportAnnotationsIssue/testcrashsupport
  2. Run the command at the root of the folder testcrashsupport: mono .paket/paket.exe restore
  3. Run the command msbuild

Include any relevant Exception Stack traces, build logs, adb logs:

"/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj" (default target) (1) ->
(_VerifyXamarinAndroidSupportVersions target) -> 
  /Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018: The "VerifyVersionsTask" task failed unexpectedly. [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018: System.IO.FileNotFoundException: Could not find file "/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/obj/project.assets.json" [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018: File name: '/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/obj/project.assets.json' [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <b4d1a66727f44ba888b54966284fabb4>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) [0x00000] in <b4d1a66727f44ba888b54966284fabb4>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool) [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize, System.Boolean checkHost) [0x00067] in <b4d1a66727f44ba888b54966284fabb4>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) [0x00000] in <b4d1a66727f44ba888b54966284fabb4>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at System.IO.StreamReader..ctor (System.String path, System.Boolean detectEncodingFromByteOrderMarks) [0x0000d] in <b4d1a66727f44ba888b54966284fabb4>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at System.IO.StreamReader..ctor (System.String path) [0x00000] in <b4d1a66727f44ba888b54966284fabb4>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at (wrapper remoting-invoke-with-check) System.IO.StreamReader..ctor(string) [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at System.IO.File.ReadAllText (System.String path) [0x00000] in <b4d1a66727f44ba888b54966284fabb4>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at Xamarin.Android.Support.BuildTasks.NugetPackages.GatherProjectJsonVersions (System.String packageIdPrefix, System.String projectExtensionsPath, System.Collections.Generic.IEnumerable`1[T] excludedPackages, System.Version monoandroidVersion, System.Collections.Generic.Dictionary`2[TKey,TValue] packageVersions, Microsoft.Build.Utilities.TaskLoggingHelper log) [0x00011] in <44cd994afc7545758ea279b67fdd7f4e>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at Xamarin.Android.Support.BuildTasks.VerifyVersionsTask.Execute () [0x00198] in <44cd994afc7545758ea279b67fdd7f4e>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <77054ab36c6842898cd2b21ace6de68e>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]
/Git/Github/Fabulous/packages/androidapp/Xamarin.Android.Support.Annotations/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(17,3): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in <77054ab36c6842898cd2b21ace6de68e>:0  [/Git/Github/Fabulous/samples/Shell/Fabimals/Droid/Fabimals.Droid.fsproj]

@TimLariviere TimLariviere changed the title VerifyVersionsTask fails when using neither packages.config or PackageReference VerifyVersionsTask fails when using neither packages.config nor PackageReference Jun 10, 2019
@logeshpalani33
Copy link

Downgrade your package version 28.0.0.2 to 28.0.0.1, it works for me

@eman1986
Copy link

is there an ETA on when this will be fixed?

@TimLariviere
Copy link
Author

This issue is not related to the bugged 28.0.0.2

@JuanuMusic
Copy link

I confirm this issue once I updated to version 9.0 and above

@tim-brand
Copy link

This issue is not related to the bugged 28.0.0.2

True. I'm having the same with 28.0.0.1
Seems indeed started to happen since upgrading to 9.0, but this is required for at lease one of the packages I need.

@tim-brand
Copy link

I noticed there's a 28.0.0.3 release. But this isn't available as nuget yet.
Will this fix the issue?

@stroborobo
Copy link

This is very unfortunate as Xamarin.Essentials requires API version 28.

@iashaik
Copy link

iashaik commented Sep 16, 2019

I noticed there's a 28.0.0.3 release. But this isn't available as NuGet yet.
Will this fix the issue?

28.0.0.3 Doesn't help either, I am stuck with my development.

It occurs on all the machines that I tried, I have at least 5 packages (Firebase) that require v.9 and hence Andriod 28, I am surprised this issue is open for so long with still no light at the end of the tunnel.

@jamesmcroft
Copy link

After landing here from Google after having the same issue, I thought I'd be here to find a solution for the problem.

Is this a breaking change in the Support Libraries for Xamarin? Or does it require a specific version of Xamarin.Android to work correctly?

Having this issue with Visual Studio 2017.

@Redth
Copy link
Member

Redth commented Sep 25, 2019

There's an easy way to skip this task entirely if it's causing you issues, just put this in your .csproj:

 <PropertyGroup>
      <XamarinAndroidSupportSkipVerifyVersions>true</XamarinAndroidSupportSkipVerifyVersions>
    </PropertyGroup>

@iashaik
Copy link

iashaik commented Oct 1, 2019

Updating all problematic NuGet Packages (in my case Firebase packages) to use the supported 28.0.0.3 version did resolve the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants