Impossible to publish CefSharp.MinimalExample on Visual studio 2015 - c#

I'd like to publish the sample application CefSharp.MinimalExample (Make a .exe file) With visual studio 2015 by following this : Debug - CefSharpMinimal.Example.WinForm properties - Publish now and I still get the follwing error:
Could not find file 'Microsoft.Windows.Common-Controls, Version=6.0.0.0, Culture=, PublicKeyToken=6595b64144ccf1df, ProcessorArchitecture=, Type=Win32'.
As I did not edit anything in the source code, provided by the Sample App, I don't understand what is wrong

I had same problem, and I fixed it by removing or commenting this lines in the file app.mainfiest (in project where you see error):
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--<dependency>
<dependentAssembly>
<assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>-->

Related

Cannot build clean VSIX project: Tries to load Newtonsoft.Json which is not there?

The following build error is pestering me.
The "CompareCommonBuildTaskVersion" task could not be loaded from the assembly C:\Users\Thijs\.nuget\packages\microsoft.vssdk.buildtools\16.6.1026\tools\VSSDK\Microsoft.VisualStudio.Sdk.BuildTasks.dll.
Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 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.
I just checked the directory mentioned, and there is a Newtonsoft.Json.dll there, but it's version 12.0.2.23222 (File Version).
I'm using:
Visual Studio Enterprise 2019 Preview
Version 16.6.0 Preview 1.0
Visual Studio Enterprise 2019
Version 16.5.0
Upon reading the link EricEJ posted I checked my devenv.exe.config which has the following (correct) AssemblyRedirect:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="4.5.0.0-12.0.0.0" newVersion="12.0.0.2"/>
<codeBase version="12.0.0.2" href="PrivateAssemblies\Newtonsoft.Json.12.0.0.2\Newtonsoft.Json.dll"/>
</dependentAssembly>
Problem seems to be with the actual BuildTools package (see answer).
I tried the different BuildTools package versions again, starting from the newest and after installing, restarted VS and then did a rebuild of the solution:
Version 16.6.1026 -> March -> Not working
Version 16.6.1024 -> March -> Not working
Version 16.5.2044 - February -> Working
So far it seems the downgrade has resolved my issues.

Could not load file or assembly 'System.Spatial' or one of its dependencies

I get this error message:
Could not load file or assembly 'System.Spatial, Version=5.7.0.0,
Culture=neutral, PublicKeyToken=49ba329had364evz' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
I tried to uninstall/update System.Spatial and WindowsAzure.Storage Nuget packages but still get the error.
It's a dependency of WindowsAzure.Storage package, but funny thing is that I don't get this error when running my ASP.NET Web API project locally, but only on the Azure server.
I don't know where to find the assembly's manifest, is it packages.config?
How to get rid of this error? I already wasted two days :(
Changed the version details in configuration file based on DLL version present in bin folder of project having issue.
In configuration file it was referring to version 5.6.4 but I have changed to version 5.6.3 which resolved the error.
Before Change
<dependentAssembly>
<assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
</dependentAssembly>
After change.
<dependentAssembly>
<assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.3.0" newVersion="5.6.3.0" />
</dependentAssembly>
if you are using visual studio, go to nugget package manager and view installed packages, and use update pane to update system.spatial package,
this solved my issue
For some reason I don't know, Visual Studio wasn't uploading newer .dll file to the server.
So I manually uploaded System.Spatial version 5.7.0 on the server.
(although still I don't know how could I change the version in a so called manifest.)
Fit all dependencies to your current azure version by the following two steps:
open Package Manager Console window
enter PM> Install-Package WindowsAzure.Storage -Version [your_version_number]-preview -Pre
this is what solved the problem in my case.

Asp.net MVC 5.2.2 on Azure

After upgrading mvc nuget package from version 5.1.0 to 5.2.2 our machine (webrole) on Azure refuses to start the web role. It was in recycling state. I found an error in event log :
The description for Event ID 1007 from source Windows Azure Runtime 2.4.0.0 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
820
WaIISHost
Role entrypoint could not be created: System.TypeLoadException: Unable to load the role entry point due to the following exceptions:
-- System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetRoleEntryPoint(Assembly entryPointAssembly)
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetRoleEntryPoint(Assembly entryPointAssembly)
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.CreateRoleEntryPoint(RoleType roleTypeEnum)
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
the message resource is present but the message is not found in the string/message table
I tried to search over the internet, but with no useful answer.
I wasn't able to solve it otherwise than downgrade. Luckily package version 5.1.1 is working.
Update 1:
After some trial and error I found, that asp.net mvc packages are OK up to version 5.1.3
It looks like packages from 5.2.0 upwards are not supported.
Update 2:
We have decided to split our web and web.api, so I didn't have this problem anymore. My best guess is, that there was indeed nuget, which was referencing older asp.net mvc package.
I had a similar problem. We inherited a project and updated the ASPNET MVC version to 5.2.2.0. We couldn't deploy to Azure. The only error we could find was the one you mentioned here.
We corrected every web.config file so older versions were redirected to a newer version but we still had the same problem.
Then we wrote a small test method that iterated over every Assembly and we saw that one NuGet package was still using Asp.net MVC 4.0. This package was an old version and hadn't been updated for a while. I downloaded the source, updated the Mvc Nuget and manually inserted the dll.
We deployed again and everything went flawless.
Here is are test method.
private void TestAssemblies()
{
var allAssemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly item in allAssemblies)
{
PrintAssembly(item);
}
}
private void PrintAssembly(Assembly assembly)
{
foreach (var item in assembly.GetReferencedAssemblies())
{
if (item.FullName.Contains("System.Web.Mvc"))
{
Debug.WriteLine(item);
Debug.WriteLine("Parent: " + assembly.FullName);
Debug.WriteLine("------------------------------------------------------------");
}
}
}
MVC 5.2.2 works perfectly fine in Azure. Your role recycling is most likely an indication that either you have not properly deployed your application properly or that you have a hidden dependency on an older version of MVC that a binding redirect may not handle.
I would strongly suggest that you read all of the entries in Kevin Williamson's great series on trouble shooting Azure deployments.
There are a ton of things that can go wrong, so rather than try to create a generic one-size-fits-all list, review the blog posts and then post a comment if you are unable to figure out what specifically is happening.
Given the error that you did post, assuming you have the proper binding redirect that #Yishai Galatzer mentions, you might have a DLL in your deployment that has a hidden dependency on MVC 5.1.0.0. I would suggest using a program like Jetbrains DotPeek to inspect all of your DLLs in your package and look at their references. I suspect you'll find one that itself depends on 5.1.0.0.
I have also face similar problem with mvc5.2.2 azure deployment..
the ultimate solution is we need to add this web.config
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
</dependentAssembly>``
From the looks of it, looks like you are missing a binding redirect to MVC 5.2.2 in your web.config. This should just work.
We are working on verifying this scenario. But let us know if this works for you. In your web.config please take a look at the following section, and makes sure it matches with this xml below:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
</dependentAssembly>
I had exactly similar problem couple of days back. Please refer to this post.
You need to add <dependentAssembly> section to WaIISHost.exe.config which is generally # 'E:\base\x64' on your VM.
Many times I've found the problem to be in the ~\Views\Web.config file. It keeps a reference to the old MVC version. Just manually update it.
If that doesn't work do a full text search of your solution in Sublime Text or some other tool outside of VS and search for the version string causing you issues.
I had the same issue, where it worked fine on my Dev machine, but when deployed I was getting the assembly error. To resolve this, I had to change the "oldVersion" from version 0.0.0.0 to version 1.0.0.0
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
</dependentAssembly>
To
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
</dependentAssembly>

Error unit testing webapi controller

I'm using AspNet Web Api Client 5.0 and i am trying to unit test a web api controller.
var encservice = new EncryptionService();
var acctservice = FakeServices.GetAccountService();
var controller = new AccountController(acctservice, encservice);
controller.Request = new HttpRequestMessage();
when the code
controller.Request.SetConfiguration(new HttpConfiguration());
is executed i hit an exception
Message: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source: System.Net.Http.Formatting
Stacktrace: at System.Net.Http.Formatting.JsonMediaTypeFormatter..ctor()
at System.Net.Http.Formatting.MediaTypeFormatterCollection.CreateDefaultFormatters()
at System.Net.Http.Formatting.MediaTypeFormatterCollection..ctor()
at System.Web.Http.HttpConfiguration.DefaultFormatters()
at System.Web.Http.HttpConfiguration..ctor(HttpRouteCollection routes)
at System.Web.Http.HttpConfiguration..ctor()
at EMR.Test.Controller.AccountControllerTest.Should_Get() in c:\PremiumProjectsCollection\emr\src\EMRAzure\EMRAzure\EMR.Test\Controller\AccountControllerTest.cs:line 34
the version of newsoft.json that i am using is 6.0
I also have a assembly redirection in my confguration file
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
The test runner that im using is MStest, VS2012
You'll need to add an assembly redirect:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json"
publicKeyToken="30ad4fe6b2a6aeed"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
(assuming that the assembly version of Newtonsoft.Json is exactly 6.0.0.0.)
(note comment below is referring to a Web Api Client project having this issue)
I had the same problem with the version of Newtonsoft.Json so I deleted the older version references and used Package Manager Console to install the latest version of Newtonsoft.Json on my Web Api Client Library and Test Project.
Install-Package Newtonsoft.Json -Version 6.0.8
(note u might need to find out which is the latest version)
The problem remained so I realized there is a crash between System.Net.Http.Formatting and my latest version of Json.
To solve this, delete the System.Net.Http and System.Net.Http.Formatting references and install the WebApi Client Library via Nuget instead, as below:
Install-Package Microsoft.AspNet.WebApi.Client
This solved it for me.
I did not try this myself, but there seems to be a bug in 2012 mstest. Where you have to use .testsettings file for app.config to be picked up.
See the following link: http://social.msdn.microsoft.com/Forums/vstudio/en-US/234926d1-42c0-4ebb-af39-1626e72f6c39/why-does-assemblybinding-work-only-if-testsettings-file-is-used-vs2012rc?forum=vsunittest
I faced the same problem days ago and it took me hours to find a solution for this one.
I was testing a unit that had the latest version of NewtonSoft installed while my test project had an older version.
What i did to get around this was consolidate the versions of this library in my solution via the "Manage Nuget packages for solution" option by right clicking the solution in solution explorer.
This will update all NewtonSoft libraries present in your projects under the current solution and remove all old versions from the package control VisualStudio creates in a folder named packages in your solution directory.

Gallio error : MSTest executable was not found

I've got an annoying issue with Gallio when I try to analyse my VS2012 C# solution with my sonar-runner. When Gallio try to launch my unit test I can find this issue in the logs :
[error] Assembly XXXX
Cannot run tests because MSTest executable was not found
I've already tried some propositions of solution exposed here and here (I have installed Agents for VS 2012 and I have added a registry key with the path of my VS2012 installation) but nothing seems to work.
Thank you by advance for your help.
EDIT :
It seems that this issue come from an hard coded registry value in Gallio source code because when I try to add the InstallDir registry key for VS2010 to point to my VS2012 installation I can see a new error message.
This new error is an I/O Exception relative to the following DLL : "Microsoft.VisualStudio.QualityTools.CommandLine.dll" version 10.0.0.0 which I'm able to find in my GAC_MSIL directory but in version 11. My conclusion is that Gallio isn't fully compatible with VS2012 and the corresponding version of MSTest.
I'm going to investigate to find a way to manually generate Unit testing reports that Sonar will be able to store.
EDIT 2 :
There is finally no way to collect mstest reports in sonar for now. The only solution I found is to convert every unit test made with MSTest into an NUnit test to be able to run it with gallio and gather the results in my Sonar server.
Add the following to your machine.config located at C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.CommandLine"
publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<bindingRedirect oldVersion="10.0.0.0"
newVersion="11.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Then you will need to add a registry key called InstallDir with a value of
"InstallDir => C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\"
to the following location
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0
Then run the following command
regsvr32 "C:\YourSonarInstalation\opencover\x86\OpenCover.Profiler.dll
The issue is being discussed here. The potential solution above was posted a few days ago.
https://code.google.com/p/mb-unit/issues/detail?id=899
For Visual Studio 2013 and .net 4.5 This is a similar process.
Add the following to your machine.config located at C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config and/or C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.CommandLine"
publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<bindingRedirect oldVersion="10.0.0.0"
newVersion="12.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Then you will need to add a registry key called InstallDir with a value of "InstallDir => C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\" to the following location HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0
Then run the following command regsvr32 "C:\Program Files (x86)\OpenCover\x86\OpenCover.Profiler.dll"

Categories

Resources