Error while creating xamarin-component for android - xamarin

I have used the command
xamarin-component.exe package C:\cmp\AndroidComponent\component
for creating Xamarin component.While building the Sample android project, it is showing the below error. (I have used the command xamarin-component.exe package C:\cmp\AndroidComponent\component -verbose to display the error message in detail).
Error message:
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Bindings.targets(155,2): error MSB3644: The reference assemblies for framework "MonoAndroid,Version=v1.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [C:\cmp\AndroidComponent\component\samples\App17\VidyoClientAndroid\VidyoClientAndroid.csproj]
Note:
I am able to create a Xamarin component for iOS source code successfully. • While creating the Xamarin component for Android source code, internally msbuild.exe is getting called from 64 bit folder(C:\Program Files (x86)\MSBuild\14.0\binamd64\msbuild.exe "/p:Configuration=Release" "C:\cmp\AndroidComponent\component\samples\App17\App17.sln"...). • Build is successful when msbuild.exe is called from path: “C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe”(32 bit) explicitly while building the android project explicity.

Related

ASP.NET CORE 2.1 Preview "SharedCompilationId" parameter is not supported by the "Csc" task

I am trying run the project with views in separate class library on Mac OSX as described in below article
https://blogs.msdn.microsoft.com/webdev/2018/03/01/asp-net-core-2-1-razor-ui-in-class-libraries/
The problem is that I cannot build the class library project with Visual Studio Community 7.4 on Mac OS.
Project builds with command line (donet build) without problems but when I try to build it with Visual Studio it throws two errors:
/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.razor.design/2.1.0-preview1-final/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets(10,10): Error MSB4064: The "SharedCompilationId" parameter is not supported by the "Csc" task. Verify the parameter exists on the task, and it is a settable public instance property. (MSB4064)
/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.razor.design/2.1.0-preview1-final/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets(5,5): Error MSB4063: The "Csc" task could not be initialized with its input parameters. (MSB4063)
When I change RazorCompileOnBuild to false or remove Content from Content Build project compiles without errors.
Go to Nuget Console and add:
Install-Package Microsoft.Net.Compilers -Version 2.8.2
You will no longer get above mentioned error.
I had this problem on the build server but not locally.
The solution:
Install the updated Visual Studio on the build server. In my case 2017.15.4
As I find you can solve this issue in two ways.
Solution 1
Add Microsoft.Net.Compilers compilers package to the project.
Solution 2
Build the project using the command line. dotnet build
In my case, I had installed the .NET Core 2.1 SDK, but not the runtime.
Strange how Microsoft don't include the runtime in the SDK.
If you face this problem there are three steps you need to take:
Ensure that Nuget package and Target Framework match.
Ensure that the referenced runtime and sdk are installed.
Ensure that Visual Studio is up to date.

Plugin.FirebasePushNotification installation error in Xamarin forms

While installing Plugin.FirebasePushNotification getting error-
Could not install package 'Xamarin.Firebase.Messaging 60.1142.0'.
You are trying to install this package into a project that targets 'MonoAndroid,Version=v7.0', but the package does not contain any assembly references or content files that are compatible with that framework.
For more information, contact the package author.
after updating Android API 7.0 this installation works well(when create a new project)
BUT i already have a project with compile version Android 6.0.
While installing this plugin on this project then it shows same error.
So how to solve this installation issue on my previous project?
You need to set your <TargetFrameworkVersion> to Android 8.0 or greater.
https://developer.xamarin.com/guides/android/application_fundamentals/understanding_android_api_levels/#framework
https://www.nuget.org/packages/Xamarin.Firebase.Messaging/ version 60.1142.0 only includes a MonoAndroid80 folder which means it requires APIs from Xamarin.Android 8.0 at a minimum to compile against.
If you want to figure this out yourself, do the following:
Download https://github.com/NuGetPackageExplorer/NuGetPackageExplorer
Download the NuGet via Manual Download
Open the .nupkg
Expand the lib folder to see the respective target frameworks

Xamarin Studio 6 incompatible with NUnit 3.2.1

I've downloaded the latest copy of xamarin studio which is 6.0 build 3668. I've built a tiny console app and I'm trying to run some unit tests through the UI in xamarin, but I get a message saying that nunit 3.2.1 is unsupported. I have a fake script which does work when run in the terminal.
Full error message is here : Skipped loading assembly test because it references an unsupported version of the nunit.framework, 3.2.1.0.
Can anyone help please ?
I have also faced the problem: "Error CS0246: The type or namespace name 'NUnit' could not be found".
It's because the .dll file is not loaded in the references of the solution.
In my case, I am using Monodevelop/Xamarin Studio 7.8.4,
having multiple NUnit dlls in the monodevelop.UnitTest directory.
Duo to this reason, I had to add reference manually.
As I am using the Ubuntu 18.04 distribution, the nunit.framework.dll assembly was locketed at: usr/lib/monodevelop/Addins/MonoDevelop.UnitTesting/NUnit2/nunitframework.dll
So, I just added this assembly to the my project and the unit test was working fine.
Note: here I have added nunit.framework 2.6.4 assembly.

MsBuild to build and create a deployment package

I was trying to use the following command to build my solution, but that was giving me an error saying MSBuild target package not found
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
"C:\Users\FullPath\SolutoinName.sln" /T:Build;package
/p:Configuration=DEBUG /p:OutputPath="obj\DEBUG"
/p:DeployIisAppPath="/bidmc-defaul" /p:VisualStudioVersion=10.0
I have tried MSBuild target package not found but that did not help, then I removed package from target and ran the command and it was successful
Then I ran the following command to create a package zip
"C:\Program Files (x86)\IIS\Microsoft Web Deploy\msdeploy.exe"
-verb:sync -source:package="C:\Users\Full Path\Website\obj\Debug_PublishedWebsites\defaul_Package\myPackage.zip"
-dest:auto,computerName=localhost -allowUntrusted=true
Now this says object of type package and path cannot be created, the zip package could not be loaded, could not find part of the path
Update
fix to my first command to create package. I was giving my solution name SolutoinName.sln, I replaced it with my main project in solution myproject.csproj, with corresponding paths. That resolved my first error.
now second error has changed to "the applicatoin pool that you are
trying to use has the managedRuntimeVersion property set to v4.0 the
application required 4.5"
How should I address this, just install .NET 4.5 on build machine?
It seems you're attempting to build a VS2012.NET 4.5 or higher solution with MSBuild 4.0. That's supported, provided you install the full .NET 4.5 Framework and the required SDK's and targeting packs for VS 2012, VS 2013 and more.
Alternatively, you can upgrade to MSBuild 2013 v12.0 (for VS 2013 solutions support) or MSBuild 2015 v14.0 (VS 2015).
You need to change the VisualStudioVersion to 11 on the MSBuild call.
/p:VisualStudioVersion=11.0
Use IIS Manager to upgrade the .NET Framework version assigned to your app pool (or change your project properties to downgrade the .NET Framework version your web application targets).

Universal application with visual studio online

I'm currently setting up project in Visual Studio Online (VSO) and having troubles with setting up automated build.
My solution contains projects targeted as Universal Windows
VSO uses msbuild to run my project.
During build I see strange error messages like:
Error CS0518: Predefined type 'System.Void' is not defined or imported
Error CS0518: Predefined type 'System.Object' is not defined or imported
Error CS0246: The type or namespace name 'Uri' could not be found (are you missing a using directive or an assembly reference?)
msbuild is invoked with following parameters:
C:\Program Files (x86)\MSBuild\14.0\bin\amd64\msbuild.exe "C:\a\b0d9e3fd\test\src\Shipping.sln" /nologo /m /nr:false /fl /flp:"logfile=C:\a\b0d9e3fd\test\src\Shipping.sln.log" /dl:CentralLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:Platform=Win32 /p:TargetVersion=”Windows10” /p:TargetPlatformVersion=”10.0.10010.0” /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="14.0"
What's wrong with this? Are there any other additional parameters required to build universal windows app with msbuild?
Are you targeting the Windows 10 SDK? If so note that it is not installed on the TFS hosted build servers. Consequently you will not be able to build apps that use the Windows 10 SDK. You can see the complete list of installed software here.
Just found the solution.
If build UWP app, from VS it resolves NuGet dependencies automatically. By default VS 10 projects uses NuGet of 3rd version, which was not installed on our build machine. That's why we had such issue.
The problem was fixed with installing NuGet 3 onto build agent and configure script which resolves NuGet packages before build.
If you can't customize the software of your build agent (aka: the free Hosted Agent) another work-around is to just check in your project.lock.json file.
This is because NuGet v2.8.7 can read both project.json and project.lock.json files but it cannot generate a project.lock.json file from a project.json file.
And, if at such a time Microsoft updates NuGet for their default build agents, you can just remove it from source-control and let it generated automatically as part of Nuget -restore. Until then, just check it in.

Resources