How to export class libraries in Visual Studio 2012 - c#

In Eclipse when I implement a class library and I'm ready to deploy, I usually export and package it into a JAR file that later you can just add to the build path in another project. Is there an equivalent feature in Visual Studio? Is there a proper way to "publish" a class library and package it into a dll file to later add as a reference in another project? Or do you just usually go and dig for it in the bin folder yourself?

Most VS projects compile into a DLL. If you want your DLL to be "published" to some particular location when you build, you can use build events which can also package up your dll (you could call a batch script, for example, that takes care of that for you).
Is there a proper way to "publish" a class library and package it into a dll file to later add as a reference in another project? Or do you just usually go and dig for it in the bin folder yourself?
Sure, just add the bin\debug\yourdll.dll or bin\release\yourdll.dll as a reference in your other project, or otherwise to the location you moved it to in your build event. No need to go digging for it every time.

Change the output type to 'release' or 'Debug'.
Go to Build, Build Solution (Or f5)
Navigate to: The Solution Bin folder for release or debug.
3a. You can quickly navigate to the solution folder by right clicking the solution in the
'Solution explorer' and selecting 'Open folder in File Explorer'.
The compiled DLL file will be in that directory. (bin\release or bin\debug)

Related

How do I create an installer for a class library in VS 2013?

I am hoping to get some help to figure out how to create an installer in visual studio 2013.
My class library project generates a DLL called DataTest. The solution also has an xml file called config.xml. Currently when I build the solution the DataTest DLL ends up in the bin folder (and the config.xml is just a static file somewhere). What I want the installer to do is copy/install the DataTest DLL to C:\MyData\Test and the xml file should end up in C:\MyData\Config.
I have found this http://geekswithblogs.net/TarunArora/archive/2014/04/24/visual-studio-2013-installer-projects-ndash-hello-world-installer.aspx which seems like a good place to start but I don't have much experience with the different configurations in VS so I don't really know how to do what I want to do.
Thanks
I'm assuming you want an MSI file to do the install because you posted that link, so you're using the Visual Studio Installer projects extension.
This might also help, old but still applies:
https://www.simple-talk.com/dotnet/visual-studio/getting-started-with-setup-projects/
Configurations in Visual Studio don't really have much to do with this. The Bin, Release, Debug folders in your build are nothing to do with where you want to deploy the file on the target system. For example, if you have a Dll that you want to install in the Common Files Folder then you select that folder in the File System view of the setup project and just drag and drop the file in there. The same principle applies to the Program Files folder, which is the usual place for applications.

Visual Studios adding folder to release directory

I am trying to pull in a dependency, xulrunner to be exact. It is basically a folder of binaries and an executable called xulrunner.exe. The code initializes xulrunner for use by passing in the location of xulruner.exe to an api of another dll that my program uses.
How do I get visual studios to copy over the entire directory of xulrunner to the release folder on build so I can package xulrunner with my program and use a relative address when specifying the file path to xulrunner.exe.
You can add Post-build & Pre-build events to a project in visual studio. Go to the properties of the project and there will be a tab called 'Build Events'.
http://msdn.microsoft.com/en-us/library/42x5kfw4(v=vs.80).aspx
Should give you the necessary information.
Dragged the folder into the visual studios project.
Manually edited the folder entry in the csproject to do a recursive copy with "**"
Set the copy mode to Always

Adding Dll to Subversion from Visual Studio

I am new to SVN though I have used TFS previously. I have ASP.Net project in VS 2010. I need to add AjaxControlToolkit dll to the project. After adding this dll, I tried to commit the changes using Subversion in VS2010. The project file appears in the list of items to commit; however the newly added dll is not listed. How can I check in the newly added dll too?
Note: I am looking for an approach involving User Interface actions; not commands. I am using Tortoise SVN
Note: BIN folder has a question mark. The dll is added into that as well. So, am I supposed to checkin the BIN? There is no questionmark for the dll file inside the BIN folder too
Here are some suggestions:
Create an "ExternalDlls" folder in your projects root folder. Place external dll's (like AjaxControlToolkit.dll) in this ExternalDlls folder. Add this folder and it's contained dll's to SVN using TortoiseSVN's Add.
Now add a reference to your external dll from within Visual Studio. You should be able to right click the "References" folder and add a reference. There will be an option to "Browse" your file system. Browse to the "ExternalDlls" folder and find the dll you want to add, in this case the AjaxControlToolkit.dll. Select the dll and add it to the references.
OK - so now you should have the DLL added to your references, and an ExternalDlls folder ready to commit to SVN!
A suggestion:
Checkout ankhsvn if you are looking for Visual Studio SVN integration. You can also check out VisualSVN, but you will have to pay for it. These are nice tools to have handy and allow you to handle SVN actions directly from Visual Studio. VisualSVN is smart enough not to add unnecessary files as well.

Clickonce deploy external dll reference not found

I'm trying to deploy an application written in wpf c#. I use an external library (irrklang). I added a reference in visual studio to that dll (it is placed in the same folder as the executable). It shows up in my application files, I deploy, install on a different machine and I get the file not found exception. I looked up the exe folder and the DLL is in the folder.
What am I doing wrong, the reference seems to be correct but the program isn't finding the dll at all
UPDATE: added solution below. Still same error:(
Check the following points:
Properties of the DLL -> Use local copy = true
Project Properties -> ClickOnce Properties -> ApplicationFiles -> Check if your dll is enlisted and manually set "Include" on it.
Then try again. ClickOnce often has annoying bugs.
Found it, the external dll requires the visual studio redistributable.

ClickOnce & References

I have created a ClickOnce Solution with VS2008.
My main project references another project who references COM dll as "links".
When I build my solution in VS the dlls from the orther projects are moved in my bin folder but when I publish and launch the project these files are not presents in my Local Settings\Apps\2.0... folder.
I know that I can add each dll of the other project as a reference of my main project but I'd like a cleaner solution ...
Is it possible ?
First add those files to your project directly.
Then goto Application properties -> Publish -> Application files
Select "show all files" if you do not see the files you need and then set their
publish status to "Include" NOT "Include (Auto)". This is important or they will not be added.
Please note if you update the files, you will have to remove them and add them again
and set their publish Status again. This is a small bug.
See a previous question of mine for more info:
ClickOnce - Overwriting content files
You need to open the "Application Files" dialog in the Publish tab of your project. From there you can set the publish type (Include, Prerequisite, etc.) of each of your files.
If it's an unmanaged DLL, you'll need to add the actual .dll as a file to your project and mark its build action as "Data". You can then set the Publish Type of that file to Include.
I had the same issue.... and the only way to fix this after going through many options, was by adding those dlls to References.
It works, but I hope there would be a cleaner solution to it in future.

Categories