I have a Windows application on C# and some console application.
In that solution I have two libraries named A and B.
Library A is using reference of Library B.
But when I built my application I got the error below:-
Cannot register assembly "A.dll". Could not load file or assembly
"B.dll" or one of its dependencies. The specified module could not be found.
Do you have a circular reference? Check your library B does not hold a reference to A.
If that isn't the case, right click on your solution name.
Select 'Project Dependencies';
Select Project A and tick project B to set it as the dependency.
See the other tab 'Build Order' and make sure Project B is above project A.
If this doesn't solve your problem, Go to each project properties;
Set 'Target Framework' in Application pane and 'Platform Target' in Build pane are same for those projects.
For the win console application copy all .dll to location .exe and then test to run from
window command (cmd), after run you still get the same previous error "Cannot register assembly A.dll. Could not load file or assembly B.dll" I think the .dll was build under
Dot net framework you are using on project. Example sometime you cannot reference .dll Dot net 2.0 with the project Dot net framework 4.0
Aey.Sakon
Related
I cannot successfully compile an extension library that is freshly created using the Customization Project -> Extension Library -> Create New.
When compiling the freshly created extension library, I get the following error in the output, but no errors show in the error report:
1>C:\Program Files (x86)\Acumatica ERP\SilcotekDev\App_Data\Projects\ManufacturingTest\ManufacturingTest\Test.cs(6,7,6,9): error CS0246: The type or namespace name 'PX' could not be found (are you missing a using directive or an assembly reference?)
I have another custom extension library which had compiled successfully in the past, but today is not. Here is the full error list from that project's compilation:
I do have a custom DAC which I imported directly into the extension library, and I had compiled it before with that DAC added. Today it won't compile at all.
With update 3 of version 6.1 Acumatica has changed the target framework for its websites from 4.5.1 to 4.5.2. Unfortunately, the target version of the Addon.csproj VS project from the \App_Data\WebsiteSolution\Addon folder was not updated to .Net Framework 4.5.2 until update 9 of ver. 6.1 (build #6.10.0945). Because of the lower target version set for extension library VS project, VS cannot build the dll and therefore copy it to the Bin folder of your website.
There are 2 ways to resolve this type of an issue:
Change target framework version in VS for your extension library project:
Open the Addon.csproj VS project in a text editor, like NotePad, and change the target framework to v4.5.2 as shown in the screenshot below (located in the \App_Data\WebsiteSolution\Addon folder inside your Acumatica website root folder). Create a new customization project inside Acumatica, then in Customization Manager create extension library for the new project
There are a lot of things that could cause this problem.
1. is your program set up to read the PX namespace?
2. are you References setup the right way. You can always check by right clicking on the reference and selecting "Add reference"
I am working on a C++/CLI project with VS 2012 in Dynamic Library (.dll) and x64 mode.
If I switch the mode to Static Library, I get the error below.
Error 1 error C1107: could not find assembly 'mscorlib.dll': please specify the assembly search path using /AI or by setting the LIBPATH environment variable C:\Depot\Main\Current\Sln\ALibraryProject\Stdafx.cpp 1 1 ALibraryProject
I tried removing the reference to the mscorlib.dll then adding it again from:
Project > Properties > General > Common Properties
But that didn't help. As I know that VS handles the reference to the .NET assemblies, I don't want to add a disk file reference to it as it seems illogical! Did anybody face this before?
I had the same problem when converting my solution from the VS2010 compiler to VS2013 compiler.
I resolved it by changing the project settings (for the project containing the managed .cpp file that was throwing this error) as follows: In Project Settings | C/C++ | General | Additional #using Directories I added the macro $(FrameworkPathOverride). This resolves to the reference assembly directory for the version of .NET that you're targeting, which in my case is C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1
If I switch the mode to Static Library
This is not the typical error you get when you try to build a static library with /clr in effect. I'd have to assume you've been tinkering with project settings to get rid of the inscrutable linker errors you get when you try to do this.
Core issue is that the C++/CLI build system doesn't support static libraries that contain MSIL. Managed code doesn't use a linker, binding happens at runtime. Which makes the essential difference between static libraries and DLLs disappear. So Microsoft decided to not support it because it didn't make much sense to implement it. Unfortunately they don't yell loud enough when you try to do it anyway, the linker errors you get don't give enough of a hint what you did wrong. Workarounds, like merging with ILMerge don't work either, it cannot deal with mixed-mode assemblies. Merging the native code sections and their associated relocation table entries is very untrivial.
Keep in mind that it is fine to link native static libraries. A typical C++/CLI project has only the ref class wrappers that need to be built with /clr in effect. You can glue any amount of native code from libraries into the final assembly.
I'm forced to theorize about the actual compile error, too many programmers get this error for another reason that doesn't have anything to do with building static libraries and they are harassing me in the comments.
Do beware that targeting a different version of .NET than the one you have installed on your machine is quite a hazardous affair, particularly so if you want to target 4.0 and you have 4.5.x installed. The key element in your .vcxproj file is the <TargetFrameworkVersion>. This will be missing if you started the project targeting an old .NET version, you have to insert it yourself. The IDE also doesn't support changing it if it is present, again edit by hand.
Which is enough to coax MSBuild into generating the proper compile command. You can verify if that panned-out well, look in the *.tlog subdirectory of the Debug build directory for your project. The cl.command.1.tlog file shows the options that were passed to the compiler. It should contain:
/AI"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0"
/FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll"
Note the subdirectory, very important that it matches your intended .NET target. v4.0 in this example. And very, very important that it does not point to c:\windows\microsoft.net, the legacy location for reference assemblies.
I have the same problem. Having a dll doesn't work, as I need to provide a native C++ wrapper for a .net object so it can fulfil a natice c++ interface - I can't use .net in a dll interface - this gives a compile error
This worked as a static library in VS 2010 (with .net 4)
Some of my executables and dlls which also have some code with /clr. They don't have an issue. I'm not trying to make a net Lbirary.
I solved it by removing dependency in old and not updated mixed lib, which was also configured only in Debug configuration, and as result, it started to get the same error as yours after I changed some code.
It was not simple to find it, because error is not clear, and the dependency was set up via "Additional Dependencies" in project settings.
Open visual studio and unload your project then Go to the project folder and open file .vcxproj . Search for tag "targetFrameworkVersion"
(if not present it means ur project is not using dot net frameworks.so no requirement of change)
Change it to required version
Save the file.
And now reload the project .
I have a Visual C++ 6 project that is creating a COM DLL. This is an old project that I have not used in years but I came back to it recently to update some functionality of the DLL. The issue I am having is that when I try to manually register the DLL (using regsvr32) that is created by the project, I get no response whatsoever. It does not say it succeeds and it does not say it fails. I have verified that the DLL is not being added to the registry. I have never seen a situation with regsvr32 when it would not show any confirmation message.
Also, the DLL is set to self-register in the project and when it attempts to do this, it also does not show a message.
I have not touched this project in a long time, but the last time I did touch it, it worked without issue. Now I come back to it, and all of the sudden I am having this problem. It is as if the DLL being created by the Visual C++ project is not compatible with the current version of Windows. I have updated the development software to SP6 but it has not changed the situation.
I ran Depends on regsvr32 when it was pointing to the created DLL, and it shows this message:
LoadLibraryExW("C:\Source32\BIS\Projects\ALFA\DigiPixSvc\DigiPixObj\Debug\DigiPixObj", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The operating system cannot run %1 (182).
Can anyone please tell me why this is happening and what I can do to correct it?
Disclaimer: since I don't have VS 6.0 installed anymore, I'll have to use some Google searches to give you the exact steps for the VC 6.0 dialogs - so some of this information may be inaccurate. I believe it's correct - it's really what you'd do in the current IDE, just for VC 6.0.
Before you go through the trouble of debugging your DLL, make sure you run it through Dependency Walker to verify that all your dependencies are on your machine. Don't run Dependency Walker on regsvr32 - what matters is whether your DLL has its dependencies. If they're missing, regsvr32 won't be able to load the DLL.
To see if your DLL is getting loaded by regsvr32 when you try to register it, you need to debug through the DLLRegisterServer() function and see what happens there - this is one of the 4 entry points a COM DLL must have and regsvr32 calls this function when the DLL is about to be registered. In order to do this, you'll have to set regsvr32 as the startup program of your project and pass the full path to your debug-built DLL as a command-line parameter to regsvr32.
Bring up Project Properties for your project.
Go to the Debug tab.
Make sure the General category is selected.
Enter the full path to regsvr32 in the Executable for debug session textbox.
Enter the full path to the debug version of your DLL in the Program arguments textbox. Make sure you have a PDB file for your DLL so you can see symbol information during debugging.
Put a breakpoint on the first line in DLLRegisterServer(). The code in this function may be long or short, depending on how it was created: generated by a wizard, written by a developer, etc.
Start debugging.
Your breakpoint should be hit and you should be able to step through the registration code and see at which point it fails.
In my vc++ project I am using boost , OpenCv and JRTPLIB libraries , I have created an exe file and when i try to run it on another PC(the pc has no vc++ or the libraries mentioned) I get the error message...
"the application has failed to start because its side by side configuration is incorrect .please see the application event log or use the command line sxstrace.exe tool for details"
I am new to creating exe files and could you please help me in understanding the error. will there be dependencies which I need to copy with exe file?
For running sxstrace.exe, go to Visual Studio command prompt and type sxstrace.exe.
Usage is as follows:
Before running your application, run sxstrace in trace mode:
sxstrace.exe Trace -logfile:C:\MySxSTrace.log
Reproduce the error by starting your application
Now stop the trace by using the below command
sxstrace.exe Parse -logfile:C:\MySxSTrace.log -outfile:C:\MySxSTrace.txt
Open output file from C:\MySxSTrace.txt
What is Side by Side Configuration?
A side-by-side assembly contains a collection of resources—a group of DLLs, Windows classes, COM servers, type libraries, or interfaces—that are always provided to applications together. These are described in the assembly manifest.
Why is it Important?
In many cases, it is possible to update existing applications to use side-by-side assemblies without having to change the application code. Developers are encouraged to use side-by-side assemblies to create isolated applications, and to update existing applications into isolated applications for the following reasons:
Side-by-side assemblies reduce the possibility of DLL version conflicts.
Side-by-side assembly sharing enables multiple versions of COM or Windows assemblies to run at the same time.
Applications and administrators can update assembly configuration on either a global or per-application configuration basis after deployment. For example, an application can be updated to use a side-by-side assembly that includes an update without having to reinstall the application.
for Side by Side Configuration Incorrect,read this Article...........
.
I created a project references in one c# 4.0 project to another c# 4.0 project in the same solution.
They are both EXE projects
when I add the reference intelesense starts picking up all of the classes in the referenced project.
However when I go to compile I get the following error "The type or namespace name '...' could not be found (are you missing a using directive or an assembly reference?)". And then all of the Class names lose their blue color and get underlined in red.
Right click on Project Properties
Check Target Framework
If it is .net Framework 4.0 Client Profile than change it to .net Framework 4.0