Pedro Polonia Pedro Polonia - 2 years ago 580 Question

Unexpected exception on any build in Visual Studio Community 2015

I got build errors on any build/any project in Visual Studio Community 2015, after an reinstall.

Build errors are:

1>------ Build started: Project: TestConsoleApp, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error MSB3883: Unexpected exception:
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : at System.Security.Cryptography.SHA256Managed..ctor()
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : --- End of inner exception stack trace ---
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : at System.Security.Cryptography.CryptoConfig.CreateFromName(String name, Object[] args)
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : at System.Security.Cryptography.SHA256.Create()
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : at Microsoft.CodeAnalysis.CommandLine.DesktopBuildClient.GetBasePipeName(String compilerExeDirectory)
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : at Microsoft.CodeAnalysis.CommandLine.DesktopBuildClient.GetPipeNameForPath(String compilerExeDirectory)
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : at Microsoft.CodeAnalysis.CommandLine.DesktopBuildClient.RunServerCompilation(RequestLanguage language, List`1 arguments, BuildPaths buildPaths, String keepAlive, String libEnvVariable, CancellationToken cancellationToken)
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error : at Microsoft.CodeAnalysis.BuildTasks.ManagedCompiler.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I got this build error with WinForm, Console and other project types.

When i load any solution, i got the error "The VSPackage package did not load correctly.". If i create a new solution, i also can't build.

The VSPackage package did not load correctly msgbox

I check the xml file but no clue on how to solved this issue.

ActivityLog.xml errors (full file on pastbin)

I reinstall Visual Studio and also create an basic hello console also to troubleshoot.

Module ModuleTest

Sub Main()
End Sub

End Module

devenv flags dont make any change

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. Todos os direitos reservados.


F:>cd F:\Programas (x86)\Microsoft Visual Studio 14.0\Common7\IDE

F:\Programas (x86)\Microsoft Visual Studio 14.0\Common7\IDE>devenv

F:\Programas (x86)\Microsoft Visual Studio 14.0\Common7\IDE>

I'm using Windows 8 64 bits. Bellow is Visual Studio information:

Microsoft Visual Studio Community 2015 Version 14.0.25123.00 Update 2
Microsoft .NET Framework Version 4.6.01055

Installed Version: Community

Visual Basic 2015 00322-20000-00000-AA322 Microsoft Visual Basic

Visual C# 2015 00322-20000-00000-AA322 Microsoft Visual C# 2015

Visual C++ 2015 00322-20000-00000-AA322 Microsoft Visual C++ 2015

Application Insights Tools for Visual Studio Package 5.205.60510.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8) 14.1.11106.0 ASP.NET and Web
Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0 For additional
information, visit

ASP.NET Web Frameworks and Tools 2013 5.2.40314.0 For additional
information, visit

Common Azure Tools 1.7 Provides common services for use by Azure
Mobile Services and Microsoft Azure Tools.

GitHub.VisualStudio 1.0 A Visual Studio Extension that brings the
GitHub Flow into Visual Studio.

Microsoft Azure Mobile Services Tools 1.4 Microsoft Azure Mobile
Services Tools

PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio
extension to visualize aggregated summaries from the PreEmptive
Analytics product.

SQL Server Data Tools 14.0.60311.1 Microsoft SQL Server Data Tools

TypeScript TypeScript tools for Visual Studio

Web Essentials 2015.2 2.0.214 Adds many useful features to Visual
Studio for web developers. Requires Visual Studio 2015

Bellow is the system information (in Portuguese, my local language):

Relatório das informações do sistema escritas em: 06/05/16 16:19:58
Nome de sistema: MAXTOR8DEVPT [Resumo do sistema]

Item Valor Nome do SO Microsoft Windows 8 Enterprise Versão 6.2.9200
Compilação 9200 Outra descrição do SO Indisponível Fabricante do
SO Microsoft Corporation Nome do sistema MAXTOR8DEVPT Fabricante do
sistema Gigabyte Technology Co., Ltd. Modelo do sistema Z87X-D3H

Tipo do sistema x64-based PC Sistema SKU To be filled by O.E.M.

Processador Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 3392 Mhz, 4
Núcleo(s), 8 Processador(es) Lógico(s) Data/versão de BIOS American
Megatrends Inc. F7, 02/08/2013 Versão SMBIOS 2.7 Versão do
Controlador Incorporado 255.255 Modo de BIOS Legado Fabricante da
Placa Base Gigabyte Technology Co., Ltd. Modelo da Placa
Base Indisponível Nome da Placa Base Placa Base Função da
Plataforma Ambiente de Trabalho Estado de Arranque Seguro Não
suportado Configuração PCR7 Indisponível Diretório do
Windows C:\Windows Diretório do sistema C:\Windows\system32
Dispositivo de arranque \Device\HarddiskVolume1 Região Portugal

Camada de abstração de hardware (HAL) Versão = "6.2.9200.16442" Nome
de utilizador Maxtor8DevPT\ppolonia Fuso horário Hora padrão de GMT

Memória Física (RAM) Instalada 16,0 GB Memória física total 15,9 GB
Memória física disponível 3,16 GB Memória virtual total 25,0 GB
Memória virtual disponível 7,48 GB Espaço de ficheiro de página 9,14
GB Ficheiro de paginação F:\pagefile.sys Foi detetado um hipervisor.
As funcionalidades necessárias para Hyper-V não serão apresentadas.

Answer Source

Your workstation has the FIPS policy enabled in windows which will cause a number of encryption and hashing algorithms to fail if they're used. It's to prevent insecure encryption to be used in Banking and Military environments. Unfortunately it seems that this breaks MsBuild when building Visual Basic (and there are known issues with XAML too).

To solve the issue you need to edit MsBuild.exe.config for the version of MsBuild you're invoking (probably the one in %Programfiles(x86)%\Msbuild\14.0\bin).


        <!-- below tag will disable security policy checking for FIPS -->
        <enforceFIPSPolicy enabled="false"/> 

For more information on the impact of FIPS, read the KB Article about its effects.

You may need to do the same thing for devenv.exe.config, which can be found in %DevEnvDir% on any Visual Studio command prompt for the version you're having issues with.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download