Last week I quite suddenly got this error while building Xamarin.Android for release. Last time I built the project for release everything worked fine.
The projects builds when I choose to link no assemblies, but when I use “Link SDK assemblies only” it fails. And it fails across every branch I have. I have tried to build my master-branch that has not changed since before last time i worked, and that also fails now.
I have also tried to delete bin & obj and checked Android versions and that packages match
Visual Studio is updated, and also have re-installed it, also re-installed Xamarin and Android SDK.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2145,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamrin.Android.Common.targets(2145,5): error MSB4018: System.IO.FileNotFoundException: Could not load assembly ‘ProjectName.Droid, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
Update
I've got an answer from a Xamarin.Android contributor who explained what has happened to the build process.
The "SignAndroidPackage" MSBuild target no longer depends on the "Build" target so, I think, it implicates if an Android project has "DefaultTargets" set to only "SignAndroidPackage" then this target won't be able to find the project compiled DLL since it was not built.
Thus I assume that this is why we have "LinkAssemblies" task failed.
To resolve the error I've added the "Build" target just before "SignAndroidPackage".
Old comment
I've faced the same error in my project after migrating to Visual Studio 2019.
Everything is fine in Visual Studio 2017 and Visual Studio for Mac. Thus I presumed that it might be a bug and raised an issue on GitHub.
We may both follow it here: https://github.com/xamarin/xamarin-android/issues/3715
The solution was to remove <RunCodeAnalysis>true</RunCodeAnalysis> from the android.csproj-file. The problem was that the linker tried linkage before the packages got prepared for linking.
Related
What to do to solve "The “GetDeploymentPathFromVsixManifest” task failed unexpectedly" when trying to debug a VS extension project??
Same question was already asked multiple times with different source reasons, all for VS2017 usually for upgrading VS extensions from VS2015, and it should have been solved with VS 2019. Yet, it just popped up.
The "GetDeploymentPathFromVsixManifest" task failed unexpectedly.
System.TypeLoadException: Method 'get_JoinableTaskFactory' in type 'Microsoft.VisualStudio.Sdk.BuildTasks.ExtensionEngineHost' from assembly 'Microsoft.VisualStudio.Sdk.BuildTasks.16.0, Version=16.9.2017.12405, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' does not have an implementation.
at Microsoft.VisualStudio.Sdk.BuildTasks.ExtensionManagerUtilities.GetExtensionEngine(ISettingsManager manager, Boolean deletePendingUninstalls)
at Microsoft.VisualStudio.Sdk.BuildTasks.GetDeploymentPathFromVsixManifest.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
I have tried all the solution for the same error found on SO, so far to no avail. I am using VS 2019 Community 16.9.2, updated all packages, downgraded some to try, nothing really changes this error.
This is my first attempt on VSIX and I just downloaded an existing project from github and compiled it.
The github project is working (probably) since the extension is available on the marketplace.
Any other suggestions? Searches on this error in combination with the JoinableTaskFactory dont return exactly many results.
For me the solution was to do at least one of the following steps:
Delete the obj-folder in the project
Execute Reset the Visual Studio 2019 Experimental Instance. You can find this tool when you search it in the windows search bar.
Clean and Rebuild the project
Sometimes it helped if I did only one step and sometimes it only worked after doing all the steps.
I couldn't find out if there is a specific pattern behind, but doing all of the above steps always fixed the error for me.
Another issue where I got the same error was if there was the wrong external program selected under Project Properties -> Debug -> Start external Program. For VS2019 I need to select C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe
If I switched between Visual Studio Versions, then sometimes a different Visual Studio version was selected.
Uncheck: "Deploy VSIX content to experimental instance for debugging"
in solution properties->VSIX
Also Update installed NuGet packages.
How to resolve Visual Studio (MSBuild) error message:
Error occurred while restoring NuGet packages: "Invalid restore input. No target frameworks specified."
WARNING : It seems that you can't work with JetBrains Rider IDE without visual studio!
This issue can happen with Rider IDE if you haven't also installed Microsoft's Visual Studio, along with relevant add-ons libraries dealing with your project (for example Xamarin).
Installing Rider + .NET Framework + MSbuild may not be enough to resolve the issue.
Perhaps it's obvious but not for everybody, in particular developers new to .NET coding.
I had this error recently in a project which builds a NuGet package targeting multiple frameworks.
In brief, I had this in my .csproj file (presumably a git merge error):
<TargetFrameworks>netstandard2.1;net462;net48;net48</TargetFrameworks>
Note the duplicate entry for net48. The odd thing was that it still built on my machine (presumably due to something being cached on disk somewhere). Once I removed the duplicate entry everything started working again.
The problem was caused by wrong project type specified in .sln file. In the solution file the project had type {D954291E-2A0B-460D-934E-DC6B0785DB48} (Shared Project / Windows Store App Universal).
...
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SomeProject", "SomeProject", "{...}"
...
But actually the project is C# (SDK project). The problem was solved by changing the GUID/UUID in the solution file to the correct one, which is {9A19103F-16F7-4668-BE54-9A1E7A4F7556}.
...
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SomeProject", "SomeProject", "{...}"
...
Previously I was using Xamarin Studio to build the App and it was working perfectly fine. Now I copied the same solution and try to build on Visual Studio through Xamarin Mac Agent. whenever I try to run the App, I am getting following error:
The root assembly
/Users/eagle/Library/Caches/Xamarin/mtbs/builds/App1.iOS/3592b16d5f6494c29443153f9249eb47/bin/iPhone/Debug/App1.exe
conflicts with another assembly
(/Users/eagle/Library/Caches/Xamarin/mtbs/builds/App1.iOS/3592b16d5f6494c29443153f9249eb47/bin/iPhone/Debug/App1.exe).
Upgrade the VS to current stable channel version, refer to here
Try to rename Application Name in your project in visual studio,since both two assembly would be referred to same place.
I recently create a couple of VSPackages for some Visual Studio extensions (menu bar/command). I compiled them correctly yesterday, checked into TFS (i'm the only one touching this project, FYI). I had already installed these extensions and were working fine. Today it doesn't compile! I get the following error:
Exception has been thrown by the target of an invocation.
This doesn't tell me anything, so i fired up Visual Studio with the following command:
devenv.exe /Rebuild > out.log
In my out.log, I see the following:
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets(420,5): error : Exception has been thrown by the target of an invocation.
I have been stuck on this for hours and can no longer build these VSPackages. Anyone? This is really frustrating. I have already tried cleaning project/rebuilding/build using Visual Studio itself (not command line)
I've experienced this issue several times in both vs2010 and vs2012, and manually deleting the "bin" and "obj" folders from the project then doing a "rebuild" normally does the trick.
Further to the answer provided by the OP, I will provide it here for completeness instead of relying on the external link remaining live:
Quoted directly from the MSDN forum answer:
Do you happen to have these extensions installed to the AllUsers
location (i.e. %VSInstallDir%\Common7\IDE\Extensions)?
You mentioned in your initial post that "I had already installed these
extensions and were working fine."
The task that's failing (based on the line number in the targets file)
is the UninstallExtension task. The only reason I'm thinking this task
would execute and fail in your situation is if you're building an
extension that's already installed to the Common7\IDE\Extensions
directory.
Regards, Aaron
I find myself on this question because of exactly the same build issue of a VSIX Installer Project for our project templates. This solved my issue.
Indeed, I uninstalled the prior version of our templates and the build occurs without issue.
Have you double checked that all of your projects are using compatible framework versions?
As in you can't use a .Net 4.0 assembly in a .Net 3.5 project.
Is the project linked with source control like TFS? If so then take latest from TFS and try again.
Are you running Visual Studio as Administrator?
Maybe you have insufficient rights for some file (copy/move/delete) especially in bin or obj folders.
I'm working on a .NET Compact Framework 3.5 app. I have an automated build machine that does not have Visual Studio installed, and all has been fine.
I'm trying to a a new solution containing control projects that have DesignTimeAttributes.xmta files. MsBuild on the build machine is failing with cannot find file, C:\Program Files\Microsoft Visual Studio 9.0\SDK\v3.5\Bin\genasm.exe.
I've tried manually adding this directory and it's contents from my dev box to the build machine, but now I'm getting
c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CompactFramework.Common.targets(67,9): error : genasm.exe(1) : error There was an error reading arguments. Could not load file or assembly 'Microsoft.CompactFramework.Build.Tasks, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Done executing task "BuildAsmmeta" -- FAILED.
Before I struggle further with this, I thought I'd ask if anyone else out there has gotten a CompactFramework project with design time attributes building on a machine without Visual Studio?
Filburt: I've already installed the Windows SDK, the .NET SDK, and the CF SDK. I realize now that "all has been fine" in the original question doesn't make that clear.
None of the SDK's installed anything into the Microsoft Visual Studio 9.0 directory.
I've given up and installed VS at this point, but thanks for the answer.
You think need to install the Windows .NET Framework SDK on your build machine to obtain the tools that come with Visual Studio.
update
Since you stated you installed all SDKs you could check %ProgramFiles%\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.cmd for any quirks in the PATH settings. I discovered some inconsistencies there for an x64 environment.