Forum Xamarin.Forms

Nugets giving error: Restored using '.NETFramework, Version=4.61' instead of the target framework'

jwartofskyjwartofsky Member ✭✭
edited February 2018 in Xamarin.Forms

I've been trying different packages to try and convert a docX to a PDF, but they're all throwing the same warning, and then further errors if I attempt to use their code. Here's a screenshot of a blank app with some of the nuget packages installed. The errors are the same even if I just have the packages installed individually.

Here's one showing the packages I have installed:

Showing more of the errors:

How do I update the target framework to 4.6.1? Or is that not a thing I can do? I'm pretty sure the packages aren't broken, I get the same errors regardless of what package I try to use. So far I've tried Sautinsoft.pdfmetamorphosis, DocX, Syncfusion, and a couple others. Visual Studio Professional is on version 15.5.7. How do I fix this?

Answers

  • ArcaniaaArcaniaa Member

    I have the same issue as i mention with only the Microsoft.net.http Packages, i hope someone's come's up with a solution soon till then am trying to find an solution.

  • sivabhavanisivabhavani USMember ✭✭

    Hi All,

    I am also got the same type of issue while using Zxing.net for barcode scanning

    warning NU1701: Package 'ZXing.Net.Mobile 2.3.2' was restored using '.NETFramework,Version=v4.6, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

    Please help me ..

    Thanks, in advance

  • Hi @jwartofsky @sivabhavani @Arcaniaa ,

    It seems that you are referring incorrect NuGet packages to perform Word to PDF conversion in Xamarin platforms. Please refer this article to know about Word to PDF conversion in Xamarin platforms.

    Note: I work for Syncfusion.

    Regards,
    Balasubramanian

  • jwartofskyjwartofsky Member ✭✭
    edited March 2018

    Tried Microsoft.Office.Interop and getting the same kind of errors. How do I fix this?

  • jwartofskyjwartofsky Member ✭✭

    @Arcaniaa said:
    I have the same issue as i mention with only the Microsoft.net.http Packages, i hope someone's come's up with a solution soon till then am trying to find an solution.

    @sivabhavani said:

    Hi All,

    I am also got the same type of issue while using Zxing.net for barcode scanning

    warning NU1701: Package 'ZXing.Net.Mobile 2.3.2' was restored using '.NETFramework,Version=v4.6, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

    Please help me ..

    Thanks, in advance

    Did you ever find a solution? Still getting the error on all packages, also tried Microsoft.Office.Interop but getting the same thing

  • sivabhavanisivabhavani USMember ✭✭

    Hi jwartofsky,

    I think the problem is with visual studio solution of project type..

    Recently I was updated my visual studio to VS 2017 Professional 15.5.1

    I am taking a new project form the template -- in solution explorer it shows like dependencies...it is not a type of pcl

    my observation is ...Please find the following screen shots

    Portable Class Library (PCL) Missing .. (references are missing


    )

    Please help me..
    Thanks, in advance

  • Hi @jwartofsky ,

    Microsoft.Office.Interop assemblies are targeting .NET Framework only; so you cannot able to reference these assemblies in your Xamarin applications.

    You can manually download the Microsoft.Office.Interop.Word assemblies from nuget.org, unzip it and with the lib folder you can only able to see the folder net20 (targeting .NET Framework) only.

    In Xamarin application, you can able to make use of assemblies which are targeting for .NET Standard or Portable class library.

    For example, let us take a look at the System.Data.SqlClient package from nuget.org. Here, you can able to see that these package contains folders – net46, net451, net461 (targeting .NET Framework), netstandard1.2, netstandard1.3, netstandard2.0 (targeting .NET Standard). Hence this package can be used with Xamarin and .NET Framework applications.

    If your requirement is to perform Word to PDF conversion in Xamarin application, please refer this article to know about Word to PDF conversion in Xamarin platforms.

    Note: I work for Syncfusion.

    Regards
    Balasubramanian

  • jwartofskyjwartofsky Member ✭✭

    @BalasubramanianSundararajan said:
    Hi @jwartofsky ,

    Microsoft.Office.Interop assemblies are targeting .NET Framework only; so you cannot able to reference these assemblies in your Xamarin applications.

    You can manually download the Microsoft.Office.Interop.Word assemblies from nuget.org, unzip it and with the lib folder you can only able to see the folder net20 (targeting .NET Framework) only.

    In Xamarin application, you can able to make use of assemblies which are targeting for .NET Standard or Portable class library.

    For example, let us take a look at the System.Data.SqlClient package from nuget.org. Here, you can able to see that these package contains folders – net46, net451, net461 (targeting .NET Framework), netstandard1.2, netstandard1.3, netstandard2.0 (targeting .NET Standard). Hence this package can be used with Xamarin and .NET Framework applications.

    If your requirement is to perform Word to PDF conversion in Xamarin application, please refer this article to know about Word to PDF conversion in Xamarin platforms.

    Note: I work for Syncfusion.

    Regards
    Balasubramanian

    In Syncfusion, how do I convert a byte array into a word document?

    Here's my code:

        async void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            Publication p = (Publication)e.SelectedItem;
            Debug.WriteLine(p);
            if (p.folderID.Equals("-1"))
            {
                using (Stream respStream = await post(p.docNum))
                {
                    string ext = p.appextension.ToLower();
                    byte[] buffer = new byte[respStream.Length];
                    respStream.Read(buffer, 0, buffer.Length);
                    string path = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/downloadedFile." + ext;
                    File.WriteAllBytes(path, buffer);
                    switch (ext)
                    {
                        case "pdf":
                            await Navigation.PushAsync(new PDFViewPage(path));
                            break;
                        case "docx":
                            WordDocument doc = new WordDocument();
                            //doc needs to get data from byte array at "path"
                //convert doc to PDF
                    //await Navigation.PushAsync(new PDFViewPage(pdf));
                            break;
                        default:
                            Debug.WriteLine("wasn't pdf");
                            Debug.WriteLine("was a ." + ext);
                            break;
                    }
                }
            }
            else
            {
                await Navigation.PushAsync(new PublicationsPage(p.folderID));
            }
        }
    
  • Hi @jwartofsky

    Yes, it is possible to open a Word Document from a byte array using Essential DocIO. To achieve this, you need to convert a byte array to a memory stream and use the memory stream in WordDocument constructor . We have prepared a sample to illustrate this which can be downloaded from the following link.
    Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/WordToPDF2074563522

    Note: I work for Syncfusion.

    Regards,
    Balasubramani

Sign In or Register to comment.