CA0053 unable to load rule assembly rules.dll VS 2017 - code-analysis

How to resolve this error
CA0053 CA0053 : Unable to load rule assembly 'c:\program files (x86)\microsoft visual studio\2017\enterprise\team tools\static analysis tools\fxcop\rules\rules.dll':
Could not load file or assembly 'file:///c:\program files (x86)\microsoft visual studio\2017\enterprise\team tools\static analysis tools\fxcop\rules\rules.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Tried to remove these tags from the project file, these tags doesn't exist in project file.
<CodeAnalysisRuleDirectories>…</CodeAnalysisRuleDirectories>
<CodeAnalysisRuleSetDirectories>…</CodeAnalysisRuleSetDirectories>
any other way of fixing this issue

Related

Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.0.0.0

I am using VS2017, MSBuild version 15.0. I have been installing taichi(https://github.com/yuanming-hu/taichi) .I have been facing lots of errors and trying to solve each step by step and now I am stuck with the following error. I have MSbuid 15.0 but it is looking for version 4.0 .
Build FAILED.
"C:\Users\5000\Documents\spgrid_topo_opt-master\taichi-master\build\taichi.sln" (default target) (1) ->
"C:\Users\5000\Documents\spgrid_topo_opt-master\taichi-master\build\ZERO_CHECK.vcxproj" (default target) (2) ->
(SetTelemetryEnvironmentVariables target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.DesignTi
me.targets(491,5): error MSB4062: The "SetEnv" task could not be loaded from the assembly C:\Program Files (x86)
\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Build.CppTasks.Common.dll. Could not
load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f
7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask>
declaration is correct, that the assembly and all its dependencies are available, and that the task contains a p
ublic class that implements Microsoft.Build.Framework.ITask. [C:\Users\5000\Documents\spgrid_topo_opt-master\tai
chi-master\build\ZERO_CHECK.vcxproj]
0 Warning(s)
1 Error(s)
1.Please open Developer Command Prompt for VS2017(come with build tools) and type the build command like: msbuild ZERO_CHECK.vcxproj
2.Check if it makes any difference,if same issue persists open vs installer and update the build tools to latest version. Then build the C++ project to check if it helps
I configured the similar environment like yours. And use the SetEnv task in .vcxproj file. But all works well when building the project.
So if all above can't work to resolve the issue: There is possibility that you call msbuild programmatically in code. If so, maybe you can get some help from this issue:
Try binding redirection, thanks to Nicolas.
Also, you can check this thread.
Any update feel free to contact me:)
Edit your PATH environment variable to ensure the first path to a directory containing msbuild.exe is the one included with Visual Studio 2017. This may be one of the following paths, depending on the edition you have and whether you installed it to the default location.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\

Microsoft.Build.CPPTasks.Common cannot find Microsoft.Build.Tasks.Core

I just upgraded a project from Visual C++ 2012 to Visual C++ 2017 and I'm getting build failures from MSBuild:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Current.targets(64,5): error MSB4062: The "SetEnv" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Build.CppTasks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\src\my-project.vcxproj]
The Fusion log shows bad things:
*** Assembly Binder Log Entry (2/12/2018 # 1:44:29 PM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/windows/Microsoft.NET/Framework/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = msbuild.exe
Calling assembly : Microsoft.Build.CPPTasks.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Build.Utilities.Core.DLL.
LOG: Attempting download of new URL file:///C:/windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Build.Utilities.Core/Microsoft.Build.Utilities.Core.DLL.
LOG: Attempting download of new URL file:///C:/windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Build.Utilities.Core.EXE.
LOG: Attempting download of new URL file:///C:/windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Build.Utilities.Core/Microsoft.Build.Utilities.Core.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE/VC/VCTargets/Microsoft.Build.Utilities.Core.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE/VC/VCTargets/Microsoft.Build.Utilities.Core/Microsoft.Build.Utilities.Core.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE/VC/VCTargets/Microsoft.Build.Utilities.Core.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE/VC/VCTargets/Microsoft.Build.Utilities.Core/Microsoft.Build.Utilities.Core.EXE.
LOG: All probing URLs attempted and failed.
Just posted this at Visual Studio Community but in another almost identical bug report they closed it as "Not a Bug" for reasons I cannot comprehend. I'm hoping StackOverflow will be more helpful. :)
Microsoft.Build.CPPTasks.Common cannot find Microsoft.Build.Tasks.Core
It seems you are using the old MSBuild.exe from .NET framework. You should use the MSBuild.exe from following location after you upgraded your project from VS2012 to VS2017:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe
That because MSBuild is now part of Visual Studio!:
Starting with Visual Studio 2013, the 2013 version of MSBuild will
ship as a part of Visual Studio instead of the .NET Framework. This
transition allows us to more rapidly evolve MSBuild.
Hope this helps.
You will have to edit the file in this directory:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets
Called:
Microsoft.Cpp.Clang.targets
Edit line 17 into:
<UsingTask TaskName="ClangCompile" AssemblyFile="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Build.CppTasks.Common.dll"/>
Be warned if this does create additional problems you might need to install proper MSBuild.

MSBuild.Community.Tasks issue with vs2017

Folks I've a set of services first created in 2012, which - down the years - have seamlessly built with Vs2010, Vs2013 & Vs2015.
When I try to build with Vs2017 I get
The MSBuild.Community.Tasks.Attrib task could not be loaded from the assembly
The assembly lives under the C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\MSBuildCommunityTasks folder, however there is no MSBuildCommunityTasks folder under the \2017\Professional\MSBuild folder.
Here's the full error
C:\working\MySolution\build\Build.proj" (default target) (1) ->
(SetAssemblyVersion target) ->
C:\working\MySolution\build\Build.proj(100,5): error MSB4062: The "MSBuild.Community.Tasks.Attrib" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.dll.
Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.dll' or one of its dependencies.
The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
What changed between Vs2015 and Vs2017?
What do I need to do to fix this?
Explicitly setting the MSBuildCommunityTasksPath property gets past the problem.
I do this at the top of my build.proj file.
(For historic reasons we keep the community build tasks in our repo, which is why it's set to a location under trunk)
<MSBuildCommunityTasksPath>$(trunk)\Ref\Build\MSBuildCommunityTasks</MSBuildCommunityTasksPath>
The extensions are most likely installed in 'C:\Program Files (x86)\MSBuild'. So I currently set the variable explicitly in my proj as a workaround.
<MSBuildExtensionsPath>C:\Program Files (x86)\MSBuild</MSBuildExtensionsPath>
Installing .Net Framework 3.5 development tools in VS2017 individual components section fixed my build.

Visual Studio 2015 not able to locate custom report assembly

I am getting this error in Visual Studio 2015 report project. This project builds fine in VS2012. I suspect VS2015 is not able to locate a custom assembly at compile time. But I am not sure which all paths it is searching.
Error [rsErrorLoadingCodeModule] Error while loading code module:
‘xxxx.Reports.SDK, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null’. Details: Could not load file or assembly
'xxxx.Reports.SDK, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. The system cannot
find the file specified.
I have already deployed my custom assembly on these locations but it did not help.
- C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies
- C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies
- C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting
Services\ReportServer\bin
- C:\Program Files (x86)\MSBuild\14.0\Bin
- C:\Program Files (x86)\MSBuild\12.0\Bin
Please help me resolve this issue. Thanks.
You should deploy your custom assembly to the VS2015 Folder for private assemblies (in standard installations: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies"

MSBuild with BizTalk failing

I am trying to set up a build server for BizTalk 2010 projects. I have installed the "Project Build Component" portion of BTS 2010 Enterprise only. However, I am getting the following error when trying to compile the solution:
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(115,9): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. [C:\CCNetBuild\FlexTMS.TLAutoTender.BizTalk\Trunk\Echo.BAS.TLAutoTender.Internal.Maps\Echo.BAS.TLAutoTender.Internal.Maps.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(115,9): error MSB4018: File name: 'Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [C:\CCNetBuild\FlexTMS.TLAutoTender.BizTalk\Trunk\Echo.BAS.TLAutoTender.Internal.Maps\Echo.BAS.TLAutoTender.Internal.Maps.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(115,9): error MSB4018: at Microsoft.VisualStudio.BizTalkProject.Compiler.MapCompiler.Compile(BizTalkBuildSnapshot buildSnapshot, IEnumerable1 mapFilesToCompile, IEnumerable1 schemaFiles, List1& generatedCodeFiles, List1& xsltFiles) [C:\CCNetBuild\FlexTMS.TLAutoTender.BizTalk\Trunk\Echo.BAS.TLAutoTender.Internal.Maps\Echo.BAS.TLAutoTender.Internal.Maps.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(115,9): error MSB4018: at Microsoft.VisualStudio.BizTalkProject.BuildTasks.MapperCompiler.Execute() [C:\CCNetBuild\FlexTMS.TLAutoTender.BizTalk\Trunk\Echo.BAS.TLAutoTender.Internal.Maps\Echo.BAS.TLAutoTender.Internal.Maps.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(115,9): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\CCNetBuild\FlexTMS.TLAutoTender.BizTalk\Trunk\Echo.BAS.TLAutoTender.Internal.Maps\Echo.BAS.TLAutoTender.Internal.Maps.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(115,9): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) [C:\CCNetBuild\FlexTMS.TLAutoTender.BizTalk\Trunk\Echo.BAS.TLAutoTender.Internal.Maps\Echo.BAS.TLAutoTender.Internal.Maps.btproj]
This error makes no sense. My understanding is that Visual Studio is no longer needed with the build components.
I would look at repairing the installation. You only need the build components and the SDK. Look here.
I will add the following to the previous answer, as my reputation at this point is < 50 and unable to add comments:
Microsoft Windows SDK for Windows 7 and .NET Framework 4 can be downloaded from here
Also please make sure your build command or build server is referencing MSBuild-32 bit (C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe) instead of 64 (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe)