dotnet build fails with COM exception on Win7
You can use the code under https://github.com/aspnet/dnx-watch
C:\Users\victorhu\dev\dnx-watch\src\Microsoft.DotNet.Watcher.Core>dotnet build
Compiling Microsoft.DotNet.Watcher.Core for DNXCore,Version=v5.0
C:\Users\victorhu\AppData\Local\Microsoft\dotnet\cli\bin\dotnet.exe compile-csc @C:\Users\victorhu\dev\dnx-watch\src\Microsoft.DotNet.Watcher.Core\obj\Debug\dnx
core50\dotnet-compile.rsp returned Exit Code 1
C:\Users\victorhu\dev\dnx-watch\src\Microsoft.DotNet.Watcher.Core\error CS0041: Unexpected error writing debug information -- 'Unable to cast COM object of type
'System.__ComObject' to interface type 'Microsoft.Cci.ISymUnmanagedWriter5'. This operation failed because the QueryInterface call on the COM component for the
interface with IID '{DCF7780D-BDE9-45DF-ACFE-21731A32000C}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)).'
Compilation failed.
0 Warning(s)
1 Error(s)
Time elapsed 00:00:03.4682894
PS: This is on Win7 SP1 with the latest updates and the project I'm compiling only targets dnxcore50 (no desktop)
I wonder if this is Win7 or just a machine (including Win10) that does not have Visual Studio installed.
Running windows 8 and vs 2013 pro i have the same issue
This error went away after installing VS2015. @piotrpMSFT is this an expected limitation, not being able to run without VS?
I meet same error and fixed when I install "Visual C++ Redistributable for Visual Studio 2015": https://www.microsoft.com/en-hk/download/details.aspx?id=48145
. @JumpingYang001 used Windows Server 2012 R2
@vors did this repro for you on Windows Server 2012 R2? And if it did, did it go away after installing the CRT for VS2015?
@blackdwarf I repro this on WS2012R2 as below picture:
It works fine after install "Visual C++ Redistributable for Visual Studio 2015".
@JumpingYang001 ok, so this seems like a pre-req/documentation issue then. Will update the docs.
@piotrpMSFT would be good to know why we have this pre-req though.
@blackdwarf I agree. I thought the whole point of .NET CLI was you could just build and run code like you can on Linux--all with one simple install (like using apt-get for Ruby). The readme here does not mention that there are other dependencies on Windows.
@nathan-alden there shouldn't be outside of CRT. We also have an issue that tracks chaining it in dotnet/cli#1627 .
This is not a doc issue. It is a product bug. We just learned yesterday that CRT is now a dependency again (we had gotten rid of it through linking but new usages popped up).
We can document a workaround, but the product is currently broken.
@sridhar-ms
@piotrpMSFT @gkhanna79 @schellap Any idea when we introduced the dependency on CRT redist? I see this PR has not been merged yet - https://github.com/dotnet/coreclr/pull/3425
By virtue of building with VS 2015, the native toolset always inserts the dependency on uCRT and that is made available downlevel (to Win10) by installing the redist. This is true for any native component built in any repo.
Also, presence of this CRT redist is also be required when we go to smaller OS SKUs.
Finally, I believe we are on similar boat on non-Windows - need to install components like libunwind (which require sudo unless previously installed) to be present for CoreCLR to work.
This is true for any native component built in any repo.
In this case, Roslyn is bringing it in through NativePdbWriter:
https://github.com/dotnet/roslyn/blob/master/src/Compilers/Core/Portable/NativePdbWriter/ISymUnmanagedWriter.cs#L21
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("DCF7780D-BDE9-45DF-ACFE-21731A32000C"), SuppressUnmanagedCodeSecurity]
internal interface ISymUnmanagedWriter5
{
Ok. I was under the impression that we were statically linking all the CRT libraries.
Static linking of CRT (or even carrying it applocal) puts the servicing burden on your component if there is a need to service it (e.g. security fix).
@piotrpMSFT ok, so I'm taking the documentation label off. So, what is the plan?
I just ran into the same issue. But after installing "Visual C++ Redistributable for Visual Studio 2015": https://www.microsoft.com/en-hk/download/details.aspx?id=48145 it fixed my simple build.
My machine is Windows 7 in the enterprise enviroment Service Pack 1. Visual Studio 2012.
I suggest that dotnet utility installs this package in the background if needed.