I've added a reference to the log4net assembly dll to my project.
When I build I get a warning saying:
Warning Assembly 'Lib\log4net.dll' is
incorrectly specified as a file.
I look up the help for this error on MSDN, and it says:
This warning is generated during
application manifest generation when
the build process detects that a file
reference is actually a (managed or
native) assembly.
This is exactly what I'm doing; the file reference is an assembly. What am I being told here?
How do I add a reference to an assembly dll, while not adding a reference to an assembly dll?
Try setting the Build Action property of the source DLLs to None. It solved the issue for us.
I was running into this problem myself.
This is what worked for me:
I had added an assembly as a reference and as an "Existing Resource." Deleting the file from the Solution Explorer, closing, then reopening the project worked.
Related
I have a website and need to update the dll such as Crystal Report in VS2015. However I added the update dll and rebuild it. There is an error
Could not load file or assembly 'CrystalDecisions.ReportSource, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
The new dll files are version 13. It looks like the website still references the old dll. I searched the solution and found someone has this kind of question How to update dll in asp.net. However I didn't have the view as it mention
(Double check your solution's reference to the assembly. Right-click > Properties > Specific Version should be set to False)
Would someone tell me how to solve the problem.
Remove and add again the reference to the proper dll
I am using Visual Studio Team Services as source control and have enabled continuous integration.
My project is an ASP.NET application which used Entity Framework 5. When i checkin the code and the build controller tries to build it, the following errors come up
DataModel\GenomicsTutorDataModel.Context.cs (40): The type or
namespace name 'DbSet' could not be found (are you missing a using
directive or an assembly reference?)
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets
(1578): Could not resolve this reference. Could not locate the
assembly "EntityFramework". Check to make sure the assembly exists on
disk. If this reference is required by your code, you may get
compilation errors.
In my solution i have made system.data.entity CopyLocal = True yet no success.
Any ideas?
May be you are on a 64 bits machine and the TFS server is not?
Try to build your project for Any CPU or x86.
Add the DLL you referenced for System.Data.Entity into a folder in your project or somewhere in a folder in the Source Control and reference to that one. Check this in and try to build your application again.
I have a C# 4.0 application that is referencing a type library from a C++ application. This is used for some secure COM interop, a question I originally had asked here.
On my development machine this second application is installed so I can compile without any issues. If I attempt to compile on our automated build server, or any machine with Visual Studio installed but without this second program, I receive the following errors and compilation fails:
Text for google:
The type or namespace name could not be found (are you missing a using directive or an assembly reference?)
Cannot get the file path for type library "guid...." version 1.0. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))
The referenced component 'SecurityAgentLib' could not be found
Picture for readability:
I'm not sure how to get around this other than by installing the application that registers the actual dll that implements these types, but I don't want to do that on our build server. The code that uses these types are wrapped in a class that is never instantiated unless prerequisite checks are run to verify the app is actually installed, so there is no chance of a runtime error. In fact I can run my app just fine on a machine without the second app installed - I just can't compile it there.
In visual studio the reference points to the .tlb file which is included in the solution directory, so the tlb file itself is present.
I can't imagine it should work this way, and I've searched around, but I'm apparently not searching for the right terms.
EDIT:
Running tlbimp.exe generates a dll but the type library should be sufficient for compilation, I thought at least. There is also an issue of broken references. I was reading this article Troubleshooting Broken References and it says that if the reference was to a COM component that is not installed than installing the component corrects the error, which is true.
Installing it on the build server really isn't an option. Opening visual studio and re-adding a reference if the path was broken doesn't work either.
I was able to use tlbimp to create a dll and used visual studio add a reference to that dll. That let me compile, but how would this work in an unattended build server?
EDIT
Okay I came up with two solutions that worked given my requirement of this all being unattended
Ran tlbimp to create a dll from the type library. I removed the reference to the tlb from my project and added a reference to the dll itself. When the source code was copied over to a new computer it compiled without issues.
In this scenario ideally we would checkout from SVN on the build server and copy the latest DLL from the second project, then compile this project.
I also removed the tlb and added the dll in visual studio and did a diff on the .csproj file. I don't see any downside to just having a reference to the dll instead of the tlb but if needed the build server could make modifications directly to this file to remove the tlb section and add a reference to the dll following a build of the second product.
Here are a couple options that each worked.
Ran tlbimp to create a dll from the type library. I removed the reference to the tlb from my project and added a reference to the dll itself. When the source code was copied over to a new computer it compiled without issues.
In this scenario ideally we would checkout from SVN on the build server and copy the latest DLL from the second project, then compile this project.
I also removed the tlb and added the dll and did a diff on the .csproj file. I don't see any downside to just having a reference to the dll instead of the tlb but the build server could make modifications directly to this file to remove the tlb
I have a Console application and a Class Library in a solution. Whenever I reference class library from console application it finds it but after building the solution it cannot find the type.
Although CopyLocal is set to true but the referenced assembly is not copied !
The reason was my console application target framework was Client Profile. Changing it to .NET 4.0 resolved the problem.
Is the referenced assembly in the Global Assembly Cache? Assemblies that are installed in the GAC are not copied to the output folder, even when CopyLocal is true.
I've created a windows service in VS 2010 which references the model conveniently placed in a separate project which compiles to a dll. I have no problem referencing this dll in other parts of my solution (web apps), but in my windows services the following symptoms display:
Compiler error: The type or namespace %%% cannot be found (are you missing....
I add a reference to %%% (directly to a dll copy or to the project, makes no difference).
The compile error dissapears.
I build.
The compile error reappears.
Using fw4.
What's up with that?
Edit: I can add and use other dlls ofcourse. Third party and microsoft's.
Clear out your Debug & Release folders that are created and try doing a full "Rebuild"
Always check your warning messages.
System.Web.Extensions Assembly cannot be resolved