Code Analysis with FXCop (issue after upgrading to 4.5) - analysis

I am using static code analysis and have my own custom rules.
Recently I migrated the project to VS2013 and after that when I am running the build from Team City its throwing the error saying it cannot load the ruleset...
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information
what could be the reason, also how can I tell the project to use the latest version of FXCOP?
Regards
Amal Thomas

Related

ReflectionOnly loading is not supported on this platform.F# Compiler(3053) on VSC After Installing RProvider

I installed RProvider 1.1.22 on Visual Studio and it worked with dotnetcore 3.1 and R 3.4.4. I tried to do the same thing using Visual Studio Code, but after installing RProvider I get this error "the type provider 'RProvider.RProvider' reported an error: The type provider constructor has thrown an exception: ReflectionOnly loading is not supported on this platform.F# Compiler(3053)"
Does anyone know what causes this error and its fix? If not, I would appreciate explaining the meaning of "Reflection Only loading". I tried searching it on the web but with no luck.
Update: RProvider worked with me on visual studio even with .Net 5. However, as #CaringDev mentioned, there seems to be a problem with the new dotnet build. It will only build through MSBuild.exe.
Assembly.ReflectionOnlyLoad is not supported on NET 5.0. If you want to use RProvider in VS Code you will have to target netcore3.1.
It seems RProvider does not work with new SDK-style projects. The message containing ReflectionOnly loading is mentioned in a PR
Given that the RProvider project is not actively maintained, I fear you are on your own.

How do I update my Model without updating the EF version?

I am working on a Legacy project which uses "EF4.0" (system.data.entity version 4.0.0.0 runtime version v4.0.30319.
There are many places in the project where properties on "context" objects are used which are not available in the newer version.
DB team has made some changes & added a few entities which I need to use in the project, now when I try to " Update Model From Database" VS asks me to select the version of EF I want to use and gives only 2 options "Entity Framework 5.0" & "Entity Framework 6.x". But I don't want to update to these versions, as this will require code changes in many places which I want to avoid.
This is a DLL project and in app.config there are only connection string settings, no assembly configuration sections.
The version of the visual studio I am using is VS 2017 community edition(version 15.3.3).
While googling i found some articles which suggested i installing 4.x runtime via NuGet package manager, but i couldn't find any package for version 4.0
(https://learn.microsoft.com/en-us/ef/ef6/modeling/designer/select-runtime-version)
How do I update my Model without updating the EF version?

MvcSiteMapProvider.dll not working in Visual Studio 2013

I have a MVC 2 project created in Visual Studio 2010 that use MvcSiteMapProvider.dll and works fine. But when loading the project in Visual Studio 2013, everything else work fine except it crashes at
Html.MvcSiteMap().SiteMapPath
The error message is
An exception of type 'MvcSiteMapProvider.MvcSiteMapException' occurred in MvcSiteMapProvider.dll but was not handled in user code
I believe that MvcSiteMapProvider.dll cannot be loaded correctly. I need help on this. Thanks.
Note that there is a separate DLL for each .NET framework version, and I suspect you are targeting the wrong framework. This can happen if you install MvcSiteMapProvider into your project and then change it to a different .NET framework version.
NuGet does not automatically upgrade/downgrade packages to the currently set framework version. This step must be done manually. The best way is to completely uninstall and reinstall the package as per this document. Also be sure to read this before attempting it.
But do note that if you do this NuGet will not remove any files you have changed (like Mvc.sitemap) and then prompt you whether to overwrite them. You should normally say no to each prompt to ensure your custom configuration is not overwritten.
Also note that it is not sufficient to use Assembly Binding Redirection with MvcSiteMapProvider because with each .NET framework version we create a separate build (DLL) that takes advantage of features that are not present in prior versions.

TFS Build Failing on System.Windows

I've been trying to run my build on TFS and I keep getting an error that kills my build. What's strange is that nothing except code change has been done since the issue started (Or at least that I'm aware about). I keep seeing this:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.WinFx.targets (268): Unknown build error, 'Cannot resolve dependency to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.'
I've googled this and the only thing I see is that it's because there's a Silverlight dll being used in a WPF application. My application is a WPF project, but I haven't been able to find any changes being done in any of my projects in my solution in regards to references.
For more information, this project is a branch from the main code. The main development branch runs fine, but for some reason, this build just fails.
Any ideas?
It seems like you're referencing the Silverlight version of System.Windows instead of the .NET Framework version. Have you tried installing Silverlight on the build server or changing the reference of your project to point to the normal .NET Framework version of that assembly (which .NET Framework exists on your build server)?

Not able to add .net assemblies in Test Partner Tool

We have automated an application using Test Partner 6. We have a grid in the application which has the class name "GUIObject("ClassName=WindowsForms10.Window.8.app.0.15a303f_r38_ad1 Caption='' Index=18")". We create a object of this and get the column titles.
Now we have an upgrade of the application. We are able to create the object but its an empty object. When we try to do any operation on it it throws error "invalid procedure call or arguement'. We tried adding the .Net reference and assemblies. But getting the error "This is an invalid .net assembly"
This works well with older version of application, but not new. Dot Net framework 4.5 is installed in our machine.
Any help appreciated.

Resources