dia2dump: CoCreateInstance failed - HRESULT = 80040154 - windows

I'm trying to dump the signature of a PDB on Windows 7 x64 using Visual Studio 2017 and its dia2dump. I loaded C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\DIA SDK\Samples\DIA2Dump\DIA2Dump.sln. It built successfully:
1>------ Rebuild All started: Project: Dia2Dump, Configuration: Debug x64 ------
1>stdafx.cpp
1>regs.cpp
1>PrintSymbol.cpp
1>dia2dump.cpp
1>Generating Code...
1>Dia2Dump.vcxproj -> C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\DIA SDK\Samples\DIA2Dump\x64\Debug\Dia2Dump.exe
1>Dia2Dump.vcxproj -> C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\DIA SDK\Samples\DIA2Dump\x64\Debug\Dia2Dump.pdb (Partial PDB)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
When I run it on the PDB, I get the following error:
C:\>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\DIA SDK\Samples\DIA2Dump\x64\Debug\Dia2Dump.exe" file.pdb
CoCreateInstance failed - HRESULT = 80040154
Just in case, I ran the following and it was successful, but dia2dump failed with the same error (also after reboot):
regsvr32 "C:\Program Files\Common Files\Microsoft Shared\VC\msdia100.dll"
How do I debug this?

x64 Class not registered. you need run regsvr32 with x64 bit msdiaXXX.dll
RbMm posted the correct answer as comment already. But if someone faces the same problem: To register a 64-bit-DLL you need to use the regsvr32.exe from the C:/Windows/SYSWOW64 folder! Microsoft should have named it regsvr64.exe...

As of 20 June 2018, what I did was:
regsvr32 C:\Program Files\Common Files\Microsoft Shared\VC\msdia100.dll
regsvr32 C:\Program Files\Common Files\Microsoft Shared\VC\msdia90.dll
regsvr32 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\DIA SDK\bin\msdia140.dll
Then I compiled as x64. It worked for me. If x64 didn't work, you can try x86.

For Visual Studio 2019 i had to execute:
regsvr32 "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\DIA SDK\bin\msdia140.dll"
regsvr32 "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\DIA SDK\bin\amd64\msdia140.dll"
These files were not found in any of the "Common Files" folders

I managed to get it to work by building Dia2Dump.exe as a 32-bit application. I did this in Visual Studio Community 2017 by opening the solution's project's properties, opened the Configuration Manage..., then changed the platform for the project to Win32.
I rebuilt the project, and now I no longer have CoCreateInstance failed - HRESULT = 80040154 errors! It works fine with any pdb file I give it.

Related

Visual Studio 2017 doesn't see SDK

I have Visual Studio 2017 Community Edition; along with a bunch of SDKs:
> dir "C:\Program Files (x86)\Windows Kits\10\Include"
10.0.10150.0
10.0.10586.0
10.0.15063.0
10.0.17134.0
10.0.10240.0
10.0.14393.0
10.0.16299.0
10.0.17763.0
However, "Командная строка разработчика для VS 2017" (VsDevCmd.bat) doesn't see my SDK. Environment variables:
IFCPATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ifc\x86
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include;
LIB=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86;
LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86\store\references;C:\Windows\Microsoft.NET\Framework\v4.0.30319;
resulting in
fatal error C1083: Не удается открыть файл включение: sys/types.h: No such file or directory
on compilation with cl.exe.
Are any additional steps needed to configure SDKs for Visual Studio 2017?
Quite unexpectedly, the problem was in
C:\Windows\System32
missing from PATH.
set VSCMD_DEBUG=3
helped to pin down the issue.

Visual Studio 2017 msbuild package sharepoint

I have a simple SharePoint 2013 solution which I can publish through Visual Studio - this will generate .wsp for me. However when I am trying to run build by the command:
msbuild /t:Package mySolution.sln
Build is ok but during packaging I receive an error:
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets(190,5): error : Could not load file or assembly
'Microsoft.VisualStudio.Modeling.Sdk.15.0, Version=15.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies. The system cannot find the file specified.
If I put this missing dll to C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SharePointTools then I receive another error about another missing dll...
What am I doing wrong?
Looks like this is MSBuild issue:
1.Open elevated command prompt
2.Navigate to your SDK tools
cd "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64"
Sn -Vr "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Modeling.Sdk.15.0.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Modeling.Sdk.15.0.dll"
For the following three dlls, please do same behavior from step 3 to 4
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.SharePoint.dll
Note if Microsoft.VisualStudio.SharePoint.dll not found in above path, check in
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SharePointTools\Microsoft.VisualStudio.SharePoint.dll
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.SharePoint.Designers.Models.dll
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.SharePoint.Designers.Models.Features.dll
Now you can MSBuild your SharePoint 2016 solutions by VS command promp.
Check Link, that's for Sharepoint 2016, but same works for 2013 as well: https://developercommunity.visualstudio.com/content/problem/40195/cant-use-msbuild-to-package-sharepoint-2016-soluti.html

APPX0502 Build fail in tfs but work in visual studio 2015

I had many problems, but this is something that can not be resolved when the TFS makes a compilation fails but works well when the compilation is done from the Visual Studio 2015.
I have installed: TFS 2015.
Error:
(1736,5): Error APPX0502: File 'C:\Program Files %28x86%29\Windows
Kits\10\Include\WinRT\AppxManifestSchema2010_v2.xsd' not found.
I hope someone can help me.
I resolved this on my Dev Machine by copying 2 files from the Win8.1 Kit to the Win10 kit folders
Source:
"C:\Program Files
(x86)\Windows Kits\8.1\Include\winrt\AppxManifestSchema2010_v2.xsd"
"C:\Program Files (x86)\Windows
Kits\8.1\Include\winrt\AppxManifestSchema2013.xsd"
Target:
"C:\Program Files (x86)\Windows
Kits\10\Include\winrt\AppxManifestSchema2010_v2.xsd"
"C:\Program
Files (x86)\Windows Kits\10\Include\winrt\AppxManifestSchema2013.xsd"
No idea how legit this is, or why it it needed for building from MSBuild when you can build fine in VS.

VS2012 doesn't include winres.h any more?

After installing VS2012, I can't find winres.h under folder "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC". What happen to VS2012 and why remove this header file?
By the way, in VS2010, winres.h locates in "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include"
The file is part of the Windows SDK now and since VS2012 the SDK location is different, it's now called a 'Kit' and is found in Program Files/Windows Kits. Sepcifically you can find winres.h in
C:\Program Files (x86)\Windows Kits\8.0\Include\um

How do I fix the "Prerequisite cannot be found for bootstrapping" warning in Visual Studio 2010?

I am using:
Visual Studio 2010 on a x64 machine
Building a Windows Application
Targeting .NET Framework 4 Client Profile and x86.
I am deploying with ClickOnce.
I have installed the "Microsoft Windows SDK for Windows 7 (7.1)".
Here is my problem:
On an old project, on the project properties, Publish tab, Prerequisites... button, I open this dialog box. All the listed prerequisites have a yellow, triangular warning, stating, "Prerequisite cannot be found for bootstrapping". The effect is that the ClickOnce setup.exe cannot correctly install the prerequisites for users.
If I create a new, empty project from scratch, the Prerequisites box is empty.
Here is information about various folders:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages contains all the bootstrap packages.
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages contains all the bootstrap packages.
C:\Program Files\Microsoft SDKs\Windows\v7.1 did not have a Bootstrapper folder.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\SDK that has nothing in it but an empty v3.5 folder .
Environment WindowsSdkDir=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\
Registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\GenericBootstrapper\4.0\Path = C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages
Here is what I have tried:
I have tried copying the Bootstrapper folder from C:\Program Files\Microsoft SDKs\Windows\v7.0A\ to C:\Program Files\Microsoft SDKs\Windows\v7.1 but that did not make a difference.
I have tried copying the Bootstrapper folder from C:\Program Files\Microsoft SDKs\Windows\v7.0A\ to C:\Program Files (x86)\Microsoft Visual Studio 10.0\SDK\v4.0. That did not make a difference.
Any suggestions?
Try this:
make the prerequisites with bootstrapper manifest generator
then add them into C:\Program Files (x86)\Microsoft
SDKs\Windows\v7.0A\Bootstrapper\Packages folder
If it works please notify by comment..

Resources