I have a solution with an application and a library. When debugging - breakpoints don't work and I've found (with the help of this answer) that it's because the pdb file of the library isn't copied into the application's debug folder.
I can change the output folder manually in Properties - Build - Output. But that seems like the wrong way. Visual Studio is supposed to do that automatically.
So: How do I fix Visual Studio to copy the pdb file?
You may not have a reference to the project, but to the DLL only.
Try to delete the reference to the library and add it again. Make sure you don't select the DLL as reference but select the project from from the reference manager:
Related
I have 2 separate Visual Studio C# solutions. One solution contains projects that generate DLL files (class library projects) and the other solution contains projects that depend on the DLL files from the other solution.
I have two questions about adding the DLL files from the first solution as references to each of the projects in the second solution.
When I add the DLL files as references (using the Browse option) is
there a way to use relative directories so that if I move the
solutions to a different folder I won't have to update the
references? (Assuming the two solutions are always in the same
location relative to one another.)
For example: ....\Solution1\Project1\bin\Debug\Project1.dll
If I change the DLL solution's configuration from Release to Debug I
want the other solution projects to reference the DLLs in the Debug
folder and vice versa. When adding the DLL files to each project can
I use something like the Visual Studio macro $(ConfigurationName) in
the DLL file path so that, depending on whether I build in Debug or
Release mode, I use the correct DLL file?
For example:
....\Solution1\Project1\bin\$(ConfigurationName)\Project1.dll
Thank you.
I was looking for the output of a project as a *.dll file to add it in References, but in bin folder there where Release and Debug folders.
Is there any difrence between the output.dlls?
Where is the useable output?
please explain the folders roles.
The folders correspond to your Solution Configurations, e.g. Debug or Release. You can specify custom configurations as well, and a folder would be created for it.
Instead of referencing the .DLL file directly by browsing to it, you should reference the project that defines the .DLL. If the project is not in your solution, you can add it by right-clicking on the solution title in the Solution Explorer and choose "Add" > "Existing project...".
This will allow Visual Studio to rebuild the .DLL in case you make changes, which you can now make without leaving your other project, and automatically reference the correct version, and also reference the configuration matching your project, i.e. if your project is run in Release, it will also use the release version of the .DLL.
I have an annoying error that's been popping up, and I don't know where it is coming from. The error is:
Error 31 Unable to copy file "app.config" to "bin\Debug\Framework.Tests.dll.config". Could not find file 'app.config'. Framework.Tests
The problem is, I don't have a bin\Debug folder anywhere, and it does not say from where it is trying to copy app.config. Double clicking on the error doesn't bring me to any code where it is trying to copy, so that doesn't help me either. So I don't know where I should make the app.config.
How can I find this out?
You have added a reference to a file called app.config or Visual Studio did this for you. The file does not exist on the disk, presumably because after adding the reference you later deleted the file.
Search for the missing file in your Solution Explorer, and either delete the reference or create the file.
It is most likely in the root folder of one of your projects, and should have a yellow triangle warning icon showing that the file is missing.
In an MSTest project the app.config is the one that you would like to provide any calls to the ConfigurationManager class.
It resides in the root of your test project.
The bin\debug folders will be created once the project compiles for the first time. Show all files in the solution explorer should help as they are not (and should not) be included in the project.
HTH
You probably do have a bin\Debug folder beneath your project folder, being the build target folder created by Visual Studio when you build your project for the Debug configuration.
My guess is that something (a test framework perhaps) still has the DLL file loaded, so Visual Studio can't delete and replace the existing Framework.Tests.dll.config file with the contents of your app.config. [Note: the project build action for app.config files is to copy it to the target folder renamed to match the executable with an extension of .config appended.]
In my Visual studio 2008 project, I've added app.config file where I store some app-data in xml format.
I read this data in code like this:
string somedata = ConfigurationSettings.AppSettings["somedatakey"].ToString();
when I start application in Visual studio, it works. But if I try to run the exe file (release or debug) I get error (if i debuf it it breaks on the line above):
Object reference not set to an
instance of an object.
The file app.config is not inside folder.
Is the app.config file in the same folder as your exe? If not, copy it there.
Starting debugging in visual studio builds everything, and copies the output (including app.config) to the output folder, starting it from there.
#Jullin: When you run project from visual studio editor by pressing F5 then CLR pick app.config file to read data but when you want to run project from .exe (bin/debug or bin/release) then clr read applicationName.exe.config, which you must have within your debug or release or any folder from where you access you applicationName.exe.
Like i have a window application named "WindowsFormApplication", when i build it successfully in release folder i have WindowsFormApplication.exe and WindowsFormApplication.exe.config and some other files. so make sure you release project successfully and your release folder must contain files.
While Running in from the Exe make sure that u have added app.config should be in the same directory
How can I compile a .cs file into a DLL?
My project name is WA. In my bin folder after the compilation, I found:
WA.exe
WA.vshost.exe
WA.pdb
You have to compile it:
csc /t:library source.cs -> source.dll
Are you using Visual Studio?
If you create a Class Library project in VS, add your .cs file and then compile the project, the output will be a .dll file.
You use a compiler. Csc.exe comes with the .NET Framework.
Check this link: http://msdn.microsoft.com/en-us/library/78f4aasd.aspx
You can also use an IDE like Visual Studio if you want the development process to be easier.
Its automatically created for you when you run a build in visual studio. Check the bin folder in your project folder.
For your information there are two kinds of DLL file which named "Managed" and "Un-Managed". Managed type is which you can use and add to your references in Visual Studio IDE.
However, if you want to convert each classes separately to Dll, you can use new windows application-> class library. After debugging and running that you can find DLL file in your source destination. Try it.
P.S: Usually you forced to use more than one class in one DLL file.