How to handle error "Could not load the assembly file:///C:\sample.dll. This assembly may have been downloaded from the Web." - visual-studio-2010

I downloaded some sample code for windows phone app. When I tried to run it in vs2010 it shows this error
"Could not load the assembly file:///C:\Users\sample\Microsoft.Phone.Controls.Toolkit.dll. This assembly may have been downloaded from the Web."
I changed the properties of this file and unblocked it but still it shows the same error.

The reason for that is that for some security reason the target assembly is blocked.you have to go to the folder where the assembly is stored and unlock it by right clicking properties and then the unblock button.

I also didn't see the unblock button on the offending dll. Moving my project to a folder outside my Documents folder resolved the issue for me. I use c:\myprojects\ instead of c:\users\\Documents\Visual Studio 2010\Projects

Related

Ignore other DLL Files when debugging DLL Project with target application (Visual Studio 2019)

I have a C++ DLL project in Visual Studio I've downloaded, which is a plugin module for another existing program (a media Player). The DLL created by this project is saved into the addon folder, is loaded by the media player and works great with no issues. However, I would like to be able to step through the code in the library while the player is running to understand how the code works.
The problem is that when I setup the project to launch the media player and step through the DLL project code, it starts fine and I can set breakpoints. But at certain times, the Visual Studio debugger tries to access other loaded DLLs inside the media player, which I don't have source code for, and it crashes the whole thing with an "access violation writing location blah blah blah" error. I have no interest in trying to access any other libraries the program is loading other than the one I have the source code for, so is there any way to prevent the Visual Studio Debugger from trying to hook into these other libraries? I know the error is not due to anything in the DLL project itself because it runs absolutely fine if I just tell it to "Start Without Debugging."
I have the source code for, so is there any way to prevent the Visual
Studio Debugger from trying to hook into these other libraries?
Please try these steps:
Suggestion
1) check Enable Just My Code under Tools-->Options-->Debugging-->General
2) enter Tools-->Options-->Debugging-->Symbols-->choose All modules, unless excluded and then click Specify excluded modules
then input the name of the dlls you want to exclude. Their symbols will not be loaded when you debug your application.
3) do not forget to uncheck option Warn if no user code on launch(managed only) under Tools-->Options-->Debugging-->General

"could not load file or assembly..." with sagepay dotnet integration kit

I've got the kit project working, but want to integrate it into my own web project. I used "add reference" on the project and located the "SagePay.IntegrationKit.DotNet.dll" file and added it. I was then able to reference the methods of the kit but when I come to build the project, I get:
Error 1743 Could not load file or assembly 'file:///C:\Users\localdev\Documents\Visual Studio 2013\Projects\myTest\myTest.Payment\bin\SagePay.IntegrationKit.DotNet.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Am I doing this the wrong way? Am I missing something?
Found the solution on another stackoverflow question: 8524423
Just opening the file properties in windows explorer and clicking on 'Unblock this file' should also solve the problem

Visual Studio error while trying to run project

I have the following scenario:
Visual Studio 2010 solution with one WPF-project, output file is "Tool.exe"
Eclipse Shared Library project, output file is "Tool.dll"
I place the dll in the same folder as the exe and then I try to debug using Visual Studio; but I get the following error:
Error while trying to run project: Could not load file or assembly 'Tool' or one of its dependencies. The module was expected to contain an assembly manifest.
I have managed to find a solution to the problem, rename the dll, apparently the exe and dll cannot have the same name. My question is, why is this error occuring in the first place? Why does the name of the dll affect Visual Studio? The error occurs before even trying to pinvoke the dll. If I run my application without Visual Studio it works perfectly, but I want to be able to debug it of course.
Right now renaming the dll is plan B, but before I do that I would like to know if there is anything else I can do to fix this problem?
Thanks in advance.
I found simple steps to solve this error.
1- change your windows.
2- install Symantec Endpoint Protection Client 12.1.6318.6100 x32 or x64 bit.
You can geting it software(32 bit) from link: (ftp://192.168.168.215/Public/Antivirus/Symantec/Symantec Endpoint Protection Client 12.1.6318.6100 x86.rar)
drag and drop it to your software(IE ,....) to work.
3- install all driver on your computer.
4- install Visual studio.
End

The same wixproj file only works in VS 2012 IDE, but not in VS command prompt

I am trying the steps on this page. I have installed the wix binaries in a folder on my local machine.
So I got a wix installer project created by wix VS 2010 plugin. I can use the VS 2010 IDE to build it and generate the msi file, but I cannot do the same thing with Msbuild in the VS command prompt. When Msbuild try to compile, there is an error complaining the candle.exe cannot be found:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\MyFolder\Wix\candle.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
I am pretty sure the exe is at the right place because VS IDE can find it. I would like to know what am I missing for Msbuild?
Thank you!
I found answer from here: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Error-in-candle-during-build-td7385947.html.
Before unzip the binaries, right click on the zip file, select property and choose Unblock from the first tab. Then you unzip it as normal.
As per the page provided by you, the path entered in the lines of code will help the MSBuild script to identify the WIX binaries.
<PropertyGroup>
<WixToolPath>$(SourceCodeControlRoot)\wix\3.6.3220.0\</WixToolPath>
<WixTargetsPath>$(WixToolPath)Wix.targets</WixTargetsPath>
<WixTasksPath>$(WixToolPath)wixtasks.dll</WixTasksPath>
</PropertyGroup>
The important quote here goes like:
WixTargetsPath property value must be relative to the .wixproj project
file that uses it. The WixTasksPath property is used inside
wix.targets to load WixTasks.dll
The paths should be specified properly according to the folders where you unzipped your files. Otherwise there is a chance for this error to happen. Then also the project will be running fine from VS2010 since that is reffering the WIX binaries from the installed location of WIX. But, MSBuild will refer the values you provide in the above lines of code.
So, can you please provide values you are giving for WixToolPath, WixTargetsPath and WixTasksPath. As well the path to where you are unzipping the wix36-binaries.zip or wix37-binaries.zip.
These information may help in solving this issue and accordingly I will correct this answer as well.

Unable to copy file C:\SomePath\Myfile.dll to bin\Myfile.dll Access to the path bin\Myfile.dll is denied

We just converted a VS 2008 project to VS 2010. The conversion showed no errors. Now, when building the solution. We get the following errors:
Unable to copy file C:\TI\Project\SharedAssemblies\Myfile.dll to bin\Myfile.dll Access to the path bin\Myfile.dll is denied
ANOTHER PROBLEM:
I have another problem too! One of my project is referencing a project DLL and that DLL does not exist. I tried to build the solution but that project is never building because it stops whenever there is error on any other project.
UPDATE 2:
So, instead of using the ported VS 2008 to VS 2010 solution I just opened the VS 2008 solution in VS 2010 and some of the errors have gone away. Now, I am left with couple of errors in which one of them is the following:
Error 1 Could not load referenced assembly "C:\MyProject\bin\JobManager.dll". Caught a FileNotFoundException saying "Could not load file or assembly 'C:\MyProject\bin\JobManager.dll' or one of its dependencies. The system cannot find the file specified.". C:\MyProject\ResGen
What kind of resources the resgen is trying to build and where is it located?
One common cause that I've encountered is that a unit test has the assembly loaded (like in NUnit) and that is blocking the copy. Closing NUnit, for example, clears the problem. Check for something similar that's holding on to the assembly.
I just removed the file from bin folder and everything start working
might be it help you!

Resources