"Exception has been thrown by the target of an invocation." when building a Visual Studio 2010 VSPackage - visual-studio-2010

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.

Related

The “GetDeploymentPathFromVsixManifest” task failed unexpectedly

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.

Could not load UI satellite dll 'FileTracker32UI.dll'

I've run in to an issue where I can't build a freshly created C++/CLI Class Library project in Visual Studio:
Even though I haven't made any changes I get an error when I try to compile:
Severity Code Description Project File Line Suppression State
Error Could not load UI satellite dll 'FileTracker32UI.dll'. Make
sure it exists in an LCID subdirectory of 'C:\Program Files
(x86)\MSBuild\14.0\bin\'. TestProject c:\Users\abcde\documents\visual
studio 2015\Projects\TestProject\TestProject\FileTracker 1
I've created C++/CLI Class Library projects in the past on the same computer using Visual Studio 2015 without encountering this problem. Any idea what has gone wrong?
I ran into this strange issue today without making any code change. I suspect it appeared due to overnight windows update.
In my case , I copied the two files FileTracker32UI.dll and FileTracker64UI.dll
From
C:\Program Files (x86)\MSBuild\15.0\FileTracker\3082\
To
C:\Program Files (x86)\MSBuild\14.0\Bin\3082\
and it worked. My visual studio version is
Microsoft Visual Studio Community 2015
Version 14.0.25123.00 Update 2
I am hoping the info helps someone.
I had the exactly same problem, after some windows update by my IT.
According to the information (https://forum.dlang.org/post/ezuohezwuzyitjdzpfdw#forum.dlang.org), I renamed the file "FileTrackerUI.dll" to "FileTracker32UI.dll" in the latest LCID folder (latest numbered folder in same location)
Then, it worked at my PC.
Good luck
In my case it was a path issue. Using another directory (shorter path without special characters) solved the problem

Visual Studio 2010 , QT and intellisense/highlight error

Hi have a problem with VisualStudio 2010 and the QT5 plugin, it seems that VisualStudio doesnt recognize the QT Library (despite i have installed the plugin and followed the whole procedure).
This is what I see:
https://www.dropbox.com/s/yyzvfev0zoj8x9n/visualstrudel.jpg
So the IDE highlights the QT stuff like if the files were not present, and Intellisense is not working. But, If I compile the application, it compiles without error and works like a charm.
What could be the cause of the highlight/Intellisense issue?
You cannot launch Visual Studio 2010 directly.
You will need to launch the QT 5.0.1 for Desktop(MSVC 2010) command line from Program Files->Qt 5.0.1->5.0.1
After which you will need to run the vcvarsall.bat and devenv after.
x:\program files(x86)\Microsoft Visual Studio 10.0.\VC\vcvarsall.bat
x:\program files(x86)\Microsoft Visual Studio 10.0.\Common7\IDE\devenv.exe
This is applicable to VS2012 and Qt4.5.0, though I believe Qt version does not matter.
I am not sure if it is the same/similar to VS2010, but I stumbled upon this post while looking the answer to the same question for VS2012.
Here is what you can do:
Right-click the project in your solution and select Properties.
Select Configuration Properties -> VC++ Directories.
Edit Include Directories entry.
Add $(QTDIR)\include\QtCore and any other (required by your project) Qt folders to the list (it depends what Qt headers you are using).
This has to be done to every project in your solution that uses Qt, unfortunately.
Now, there is another note:
We were transferring our solution from VS2005 to VS2012 and that problem happened to me when I converted the solution 2005->2012 BEFORE setting the QTDIR environment variable.
When I re-converted the solution again (AFTER *QTDIR* variable was created) the problem didn't appear. So make sure you have this variable before you open/convert your solution for the first time.
Based on the previous note, I believe that some information related to the issue is stored in one of the following files: .sdf and/or .v11.suo.
So closing VS, deleting these files and opening VS again might help. Just back them up before you do it - I haven't tried it myself (I just re-imported the whole solution which generated these files anew).

Why do I get "An error occurred while validating. HRESULT = '80004005'" when building a setup project?

Why do I get the following error when building a setup project?
An error occurred while validating. HRESULT = '80004005'
One project in solution had ToolsVersion="4.0" (in .csproj file), changed it to ToolsVersion="3.5" and setup project builds fine.
Both of the reasons I found are already in other answers, but they are in separate answers and not fully explained. So, hopefully this will combine the possibilities and give good means of debugging each. :)
Common Reason
My problem was not a dependency error. However, that does seem to be the common reason. So, basically, you need to check your MSI file and make sure that all dependencies are still valid. Probably the best blog response on how you can easily resolve this if it is a dependency issue is An error occurred while validating. HRESULT = '80004005'.
Extract from blog:
Follow steps below to troubleshoot.
If you have multiple project outputs in your solution, identify the project that is giving the problem. You can do that by removing one project at a time from the Setup Project(S) until error goes away.
Once project is identified, identify the reference that could be giving the problem.
Check if the project(A) is referencing to a project that has been removed from solution. - Remove such references if any.
Check if the Project(A) is referencing to a project that was moved to a diffenrent physical location after it was added as a reference. - Remove and add such references.
Rebuild setup project after fixing the reference accordingly to see if error goes away.
Alternative Reason
My problem had to do with Visual Studio versioning, however. So, if your dependencies are valid and you still are getting this problem, then you resolve this if it is a problem with VS2010 .
Basically, if you run MSBuild and see this warning:
Project file contains ToolsVersion="4.0", which is not supported by
this version of MSBuild. Treating the project as if it had
ToolsVersion="3.5"
Then the problem is Visual Studio versioning. This means that one project was opened or created in Visual Studio 2010 and then saved or added to an existing 3.5 solution. I simply searched all files in my project for ToolsVersion="4.0" and found the offending .csproj file, opened it in a text editor and manually changed the 4.0 to a 3.5.
This error is related to a dependency error. I removed all references to my primary output project and added them again. It now compiles OK!
I ran up against this issue today. The solution in my case? Restart Visual Studio 2008.
In my case my solution (VS2008) had a project that was also referenced from another solution (VS2010). In the VS2010 solution I had upgraded the project to .NET 4.0. When I later realized the project was also used in another solution I downgraded it to .NET 3.5. For some reason everything seemed to be changed correctly in the csproj file except one place which is mentioned here: Error in setup project HRESULT = '80004005'
I know this is already solved somewhere else but I wanted to shed some light on this from another problem angle.
While simply removing and re-adding the project dependencies will work in many cases, it is important to note that:
The error message "An error occurred while validating. HRESULT=80004005."
usually happens when project is referenced to the other project which is
not added into the currect [sic] solution. Setup project only supports
dependency projects within same solution.1
I have spent enormous time on this one myself, though none of the above worked. But I have found another solution with a registry hack, you need to add a new DWORD (EnableOutOfProcBuild) value of (0) to HKCU\SOFTWARE\Microsoft\VisualStudio\14.0_Config\MSBuild\EnableOutOfProcBuild
Note: this is for Visual Studio 2015
In my case I had installed Visual Studio 2010 alongside Visual Studio 2008. My setup project, when opened in Visual Studio 2008 gave the same error, but was OK in Visual Studio 2010.
If copied to another machine that did not have Visual Studio 2010, but did have Visual Studio 2008, then it would compile.
I installed Visual Studio 2010 and converted the solutions to that version. Because of performance issues I changed my solutions back to Visual Studio 2008. Everything was better now but I got an error when I tried to compile the setup project. I realized that I had a Visual Studio 2010 Test Project in my solution so all I had to do was unload the Test Project and Build the setup project again.
Summary: unload any Visual Studio 2010 project in solution.
I hope it helps.
I know this is kinda old news, but my particular issue and solution are not specifically stated here (as far as I can tell - if I missed it, I apologize).
I had same problem. It would not compile my project, but had no errors. All I could see was "Build Failed". I opened up the "Output" file (Click View--> Output on menu), and it told me exactly which reference (in my case a .dll) was causing the problem.
I deleted and recreated the reference and it changed the reference name from Microsoft.Office.Core (which was appearently only a 32 bit version) to "OFFICE". Then everything worked great. -- Make sure to make a note of the path to the file you are referencing in the properties window... My new path was exactly the same, but the reference name changed anyway.... still scratching my head on that one...
So the moral of the story is... When you get no errors and your build fails, check the "Output" tab and it might help.
I read this answer from another post on Stack Overflow, and it has worked for me.
Open your setup project file (.vdproj) in Notepad (or any other text editor). Delete these lines at a beginning of the .vdproj file:
"SccProjectName" = "8:"
"SccLocalPath" = "8:"
"SccAuxPath" = "8:"
"SccProvider" = "8:"
Build again - the error is gone. That error didn't stop me from deploying, building, debugging (or anyting) my project; it just annoyed me. And it came on even if I set all projects to be build in a current configuration and the setup project not to.

How to fix build error in Visual Studio: '"LC.exe" exited with code -1'

I get the following error when building my Windows Forms solution:
"LC.exe" exited with code -1
I use two commercial Windows Forms Libraries: Infragistics and the Gantt-Control from plexityhide.com, that's why I have licenses.licx files in my WinForms Projects. We also use Visual Sourcesafe as our Source Control.
When the licenses.licx files are in the Projects I cannot build without the above error. However, when I exclude them from my projects the build works fine. But I need the licenses.licx files when I want to work with the commercial controls in the designer.
This is a brand new developer machine with Windows XP SP3 (German) and Visual Studio 2005 Team Edition for Software Developers (German) with SP1.
It's Windows XP 32-Bit by the way.
Any suggestions?
Problem mainly arises due to license file. Exclude the file licenses.licx from your project
We frequently encounter this error from our last project. The solution is to reinstall the libraries since we're using the trial version. This occurs when the libraries expire.
I reinstalled Infragistics and that seems to have fixed it.
Is there any more information in the error message?
When I had problems with LC.exe in the past, most times it was because the licensed component was upgraded (the version number increased), but the licx file still contained the old version.
In this case, you can try to update the version in the licx file manually, or change it to x.y.z.* to just work for further updates. You can also try to re-generate the licx file by deleting it and re-inserting the licensed windows forms controls into your form.
seems the problem is due to updating the controls.
licenses.licx includes version 2 of .net controls. it works deleting lines with version 2 (after versioning).
Other times worked in this way:
add an empty form, then insert the control that caused the problem.
There should be a license.licx file in the properties folder when you use commercial components. It is often corrupted. If you clean its contents, the "LC.EXE" exited with code -1 disappears.
Had the same problem. Could not build with licenses.licx (even if blank) and had 3rd party licensing problems without licenses.licx. This problem appeared after I upgraded Visual Studio from 2015 to 2019 and changed my .NET Target Framework Version from v4.5.2 to v4.7.2. To do further testing I ran the command (from the error message) in cmd at the location of lc.exe. I got no useful errors but noticed a version mismatch. I didn't have lc.exe for 4.7.2 installed. ("C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\lc.exe"). With some guidance from this answer, I installed the .NET 4.7.2 Developer Pack and could build with licenses.licx again.

Resources