why the referenced dll of a c# project is in full path? when i move the source code to a different pc, the reference is broken.
Visual Studio tries not to use full paths to DLL's whenever possible to avoid situations like this. It tries to reference DLL's with a relative path if possible.
Is there a relative path in this scenario that would work? If so could you try editing the .csproj file manually and setting it to use this relative path and see what happens?
Related
I have two of these warnings in my project. They are identical. I have shortened the full path for brevity.
Load of property 'ReferencePath' failed. Cannot add
"...\packages\DeltaCompressionDotNet.2.0.1\lib\netstandard1.3' as a
reference path as it is relative. Please specify an absolute path.
When I look up help for it the cause is blamed on "...editing the project file by hand." which I did not do.
How can I make VS 2019 Enterprise regenerate the csproj file?
I wrote a library called MyLib with some Visual Studio projects in MyLib\Samples\, and the include files reside in MyLib\inc. In order to make these include files accessible in the projects, I need to add their path in the project properties.
I want to use a relative path, so that I don't need to change the properties each time I move the whole library folder to other places. But what does the relative path look like? For example, one of the project path is: ...\MyLib\Samples\proj1, how do I represent the ...\MyLib\inc relative to the project path?
Use the $(SolutionDir) or $(ProjectDir) MSBuild properties to root the paths. These are replaced at build-time with the directory in which the Solution and Project are located, respectively.
What you're looking for is custom properties for your project.
Visual Studio has support for defining custom properties which you can subsequently use in macro expansions in your include path, for example.
Here's an example of how it looks like:
In Visual Studio 2003, if I link with a library that doesn't have its corresponding PDB file, I get a warning:
foo.lib(bar.obj) : warning LNK4099: PDB 'other.pdb' was not found; linking object as if no debug info
If the PDBs are in their original build location VS can find them, as well as if they're in the current build directory, but that seems to be it. Is there a way I can tell Visual Studio exactly where it should look for PDBs? I have a vague notion that a symbol server might work, but that seems like a lot of overhead; I'm just looking for something like link.exe /pdbpath c:\pdbs_are_right_here that adds a path to search, like /I adds an include path. Alternately, are there other paths it searches besides the current directory and the original absolute path the PDB was written to?
I believe the path to the corresponding pdb's is embedded in the libraries themselves, and you can change it into c:\pdbs_are_right_here at the build switches for your libraries (assuming they are indeed yours and not 3rd party).
For DLL's that means project properties\linker\debugging\generate program database file.
For static libraries the default name is uniform in VS2013 ('vc120.pdb'), but I think this changed in VS2015 and have no idea about VS2003. Anyway if you're working in VS2013\2012\2010 you'd have to explicitly override the name too.
I'm new to visual studio and can't seem to find an answer to this anywhere.
I'm working on a project in VC++ with VS2010. I have another project that builds into a .lib file set up as a reference, but can't figure out how to actually include the headers. Google has proved useless. Please help!
Generally this is done by adding the directory where the include files live to the project's "Additional Include Directories" property (in the "C/C++ | General" property page).
Note that the location can be a relative path if the different projects will always be at the same file system level relative to one another, or they can use VS macros or environment variables.
I have a web application project. I am trying to find out why certain DLLs are being copied into the bin directory of the web application. As far as I can see there are no references to the DLLs under the list of references.
Whilst I don't think it should make a difference, I have been through all the DLLS of the projects that the web application depends upon and selected Copy Local=False.
But still when I build the solution, the DLLs turn up in the bin directory. I don't want them there. How can I find out what is putting the DLLs there?
An indirect reference perhaps?
That is, you reference assembly A and it references assembly B and C. Presto! B.dll and C.dll are in your bin folder. Use reflector or ildasm to check the references of the assemblies you have referenced in you project.
Check out your Post-build events which you can find in Project Properties->Build Events->Post-build event. There might a command-line instruction to copy a DLL into your bin directory.