C# Dynamic Data Linq To SQL website assembly loading - c#

I am using visual studio 2010 ultimate. I have got the following error when I try to import a dynamic data linq to sql website project on my computer:
------ Rebuild All started: Project: C:...\TestVersion99Website\, Configuration: Debug Any CPU ------ Validating Web Site Building
directory '/TestVersion99Website/App_Code/'. Building directory
'/TestVersion99Website/DynamicData/Content/'. Building directory
'/TestVersion99Website/DynamicData/FieldTemplates/'.
C:\Users\Test\Documents\Visual Studio
2010\WebSites\TestVersion99Website\DynamicData\FieldTemplates\MultilineText_Edit.ascx(7):
Build (web): Could not load file or assembly 'System.Web.DynamicData,
Version=99.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file specified.
... C:\Users\Test\Documents\Visual Studio
2010\WebSites\TestVersion99Website\DynamicData\FieldTemplates\Text_Edit.ascx(7):
Build (web): Could not load file or assembly 'System.Web.DynamicData,
Version=99.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file specified.
Validation Complete
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
The website was written using .net 3.5 sp1 framework. The System.Web.DynamicData assembly was from DynamicData 4 preview project from codeplex.
To identify the error, I have created a new dynamic data linq to sql website project using .net 3.5 framework. Once the website is built, I removed the reference to "System.Web.Dynamicdata 3.5.0.0". I created a new Bin folder, and copied the assembly "Microsoft.Web.Extensions 99.0.0.0, System.ComponentModel.DataAnnotations 99.0.0.0, System.Web.DynamicData 99.0.0.0" into the Bin folder. I then made sure that in web.config the assembly versions are changed to 99.0.0.0. However, When I tried to build the solution, I still had the same error messages. I have no idea why this is happening and am really really very frustrated.

Check for any bindingRedirect you have in your web.config.
<dependentAssembly>
<assemblyIdentity name="System.Web.DynamicData" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="3.5.0.0" newVersion="99.0.0"/>
</dependentAssembly>

Related

System.IO.FileLoadException:

This is the segment of code I used, note the **** is the replacement for my name
using System;
using ArduinoUploader;
using ArduinoUploader.Hardware;
namespace SoftwareAssignment
{
class Program
{
static void Main(string[] args)
{
var uploader = new ArduinoSketchUploader(
new ArduinoSketchUploaderOptions()
{
FileName = #"C:\Users\****\OneDrive\Desktop\Blink\Blink.hex",
PortName = "COM5",
ArduinoModel = ArduinoModel.Micro
});
uploader.UploadSketch();
}
}
I recieved the exception whilst using the ArduinoUploader to upload a .hex file onto an arduino whilst in Visual Studio 2019.
System.IO.FileLoadException: 'Could not load file or assembly 'IntelHexFormatReader, Version=2.2.3.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)'
These are the details
System.IO.FileLoadException
HResult=0x80131040
Message=Could not load file or assembly 'IntelHexFormatReader, Version=2.2.3.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
Source=ArduinoUploader
StackTrace:
at ArduinoUploader.ArduinoSketchUploader.UploadSketch(IEnumerable`1 hexFileContents)
at ArduinoUploader.ArduinoSketchUploader.UploadSketch()
at SoftwareAssignment.Program.Main(String[] args) in C:\Users\****\source\repos\SoftwareAssignment\SoftwareAssignment\Program.cs:line 20
I do not know how I should go around troubleshooting this or if it is a resultant of the ArduinoUploader package using an older verison of the .NET framework, or if there is anyway to fix this at all. The code is written in C#.
You can rebind assemblies in many ways, the easiest for me personally is in the config file. Below from
https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions
<dependentAssembly>
<assemblyIdentity name="someAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="en-us" />
<bindingRedirect oldVersion="7.0.0.0"
newVersion="8.0.0.0" />
</dependentAssembly>
Do note however that there are no guarantees the assembly you have will work as you expect, be it older or newer. I'd suggest you try to find the right one. That said, if you can't, then above is your best shot.
I hear you OP. You must understand that you need to install another NuGet package, that being IntelHexReader. Its written by the same lad, TwinEarthSoftware. Search for it in Visual Studio. You don't need to inculde it when defining the directories used. The has nothing to do with.NET framework, its just suggesting that it needs 2.2.3.0 of the IntelHexFileReader.

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.

How can I resolve the error: Could not load file or assembly 'Microsoft.VisualStudio.Threading'?

I am writing an Add-in for Visual Studio 2017. I use the following:
Dispatcher.CurrentDispatcher.Invoke(()=>
{
// ...
});
But I keep getting the compiler warning: VSTHRD001 Avoid legacy thread switching methods and since I can be a bit obsessive, I researched the warning, and applied the "fix":
ThreadHelper.JoinableTaskFactory.Run(()=>
{
// ...
});
Since applying the fix, the method won't even run, upon further investigation, it's throwing the error: 'Could not load file or assembly 'Microsoft.VisualStudio.Threading, Version=15.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'
I'm using the nuget package <package id="Microsoft.VisualStudio.Threading" version="15.7.18" targetFramework="net461" /> and I have the binding redirects from installing the package in my app.config: <bindingRedirect oldVersion="0.0.0.0-15.7.0.0" newVersion="15.7.0.0" />
I've downgraded the package and even tried changing the redirect version but to no avail. For the only other similar related issue, Microsoft insists it's not a bug.
I'm using Visual studio 15.7.3 and that dll in the C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PrivateAssemblies is version 15.6.27-beta+gca...
Any ideas? Yes Dispatcher.CurrentDispatcher.Invoke works perfect.

VS2017 .NetCore 2.0 API - Could not load file or assembly Microsoft.AspNetCore.Hosting.Abstractions

I've just created a new API using ASP.NET Core 2.0.
I haven't coded anything yet. I just want to test the initial API template.
When I try to start my project I receive the following error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Abstractions, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
I do not receive any errors when building the project.
The assemby can be found at the following directory: 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.hosting.abstractions\2.0.2'.
Is that correct? Where should the 'Microsoft.AspNetCore.Hosting.Abstractions' assembly be located and why can't VS find it?
I had the same error attempting to debug a simple Azure Function App (this is using .NET core) created from the Function App template in Visual Studio 2017. Attempting to run in debugger gave me the same error. It turned out to be I had updated the Microsoft.NET.Sdk.Functions package from version 1.0.6 to 1.0.12. That was my problem. Reverted the update back to 1.0.6 and it worked fine. Hope this helps!
Please re-install the nuget package or upgrade to the latest at: https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Abstractions/

Photon Serever. Exception: CManagedHost::StartApplication() PhotonHostRuntimeInterfaces

I got an app with server code, now I try to run it on Photon Server, but I receive an exception with PhotonHostRuntimeInterfaces, I guess there is something wrong with version, I searched a lot for such a problem, but I'm really new in server programming, so can anyone help me with this issue?
Here is the log:
*System.Exception: Stop: unable to call the Application.TearDown() - undefined photonControl.
в PhotonHostRuntime.PhotonDomainManager.PhotonPlainAppDomainBehavior.Stop()
в PhotonHostRuntime.PhotonDomainManager.Stop()
6336: 10:34:55.862 - ERROR: Failed to start application: "RagingServer" in app domain: 2
6336: 10:34:55.863 - CService::OnException() - Exception: CManagedHost::StartApplication() - Failed to start application in AppDomain: 2 - Could not load file or assembly "PhotonHostRuntimeInterfaces, Version=3.56.0.0, Culture=neutral, PublicKeyToken=6cb1467adaa73020"or one of their dependencies. The obtained assembly manifest definition does not match the assembly reference (Исключение из HRESULT: 0x80131040)
6336: 10:34:55.863 - Server shutting down...*
I also found a solution like that:
<dependentAssembly>
<assemblyIdentity name="PhotonHostRuntimeInterfaces" publicKeyToken="6cb1467adaa73020" culture="neutral" />
<bindingRedirect oldVersion="3.56.0.0" newVersion="3.58.0.0" />
</dependentAssembly>
But I'm not sure where I should put in it, on my PhotonServer.config?
this is usually placed into your application config, which looks like AssemblyName.dll.config. take a look here for examples and docs
and you back to your problem, there is at least two options:
1. you mixed sdk versions. Photon SDK version v3.4.27 is using PhotonHostRuntimeInterfaces.dll, Version=3.56.0.0. You may find it in sdk lib folder and in 'deploy\bin_Win64'. newer versions of sdk use version 3.58 of PhotonHostRuntimeInterfaces.dll. Probable you upgraded your developer machine, but did not upgrade your server
you forgot to add this dll at all. it should be in bin folder of your application
hope this will help you
-The Photonians

Categories

Resources