Visual Studios adding folder to release directory - c#

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

Related

Where to put chromedriver.exe for release of Selenium WebDriver C#

I have my chromedriver.exe in my local documents, working fine. But it's time to deploy to production. Somehow I need to bundle it with my software, and reference it locally.
How do I go about locally referencing my driver, and where should I put it?
Copy Chromedriver.exe into your project's solution / project folder. Add it to the project in visual studio. Right click the file and choose properties. Build Action should be set to 'Content'. That will mean when you build/deploy the bin folder will contain a copy of the chromedriver. When you reference the chromedriver.exe directly, you should look for it adjacent to the executable path of your program.
Good source on detecting location of current assembly/executable: How do I get the path of the assembly the code is in?

Building Service in visual studio, installer can't be checked in to tfs without being manually moved

I have a c# service that when built creates a .msi file in the debug folder. At the minute I have to manually copy the .msi out of the debug folder and place it into an install folder in another project in the same source so that tfs will identify the change and allow a check-in.
Is there anyway to set up the project so that the installer gets placed into a different directory when built for check-in?
How about adding a post build event to your project.
http://msdn.microsoft.com/en-us/library/ke5z92ks%28v=vs.110%29.aspx
You could either call a batch file, which has the commands you need, or add the commands to the post build event command line text box.
Copy file(s) from one project to another using post build event...VS2010
if everyone is working with the same workspace mappings, ie, the folder you want to output to is in the same relative path for all developers you can just change the build output location.
obviously you need to do this for each configuration or set the same for all configurations.

How to export class libraries in Visual Studio 2012

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)

Visual Studio 2010 Manage Output Files

I'm new about code developing with Visual Studio 2010 and I would like to ask you a simple question about something after build a project.
I have a C# project and when I build It in Release mode some file are created and some of them copied from another in to \output\bin\Release\ folder. My question is that How can I manage that which created dll or created file will be in \output\bin\Release\ folder.
I tried to take a look at build properties of project but I could not find any option about it.
Thank you.
Actually I do not need this dll in my project output folder because I
add this dlls as a reference to my project
And this is exactly why this file appear in output folder.
There are several ways to "put" file in output folder. For normal files in the project you can set property Copy to Output Directory.
If we talking about dll's, (as mentioned Hans), there is Copy Local property for each assembly in References.
By default VS set this according to our GAC, so if you are using 3rd part assembly or from another project VS will set this property to True and file will be copied to output folder.
If you don't want to put this file in output folder, just set this property to False. But remember, at run time this assembly should exist.
For more information: How to: Set the Copy Local Property of a Reference
Another explanation: you just messed up with Output path in the project properties and two project has the same output folder. :)
I suggest that you ignore the extra files that are created. One way to do this is to configure the destination of these to a different location.
I use this:
property pages->General
- Output Directory = $(SolutionDir)..\link\
- Intermediate Directory = c:\temp\vc10\$(SolutionName)\$(Configuration)\
Use the same settings for debug and release.

Visual Studio 2008 - Moving files at build to bin/

EDIT: This is a VS2008 app written in C#.
So I have a folder in my solution called
_lib/
It's where I keep my DLLs so that when I reference them, they get built into the bin/ folder.
Now I have a new item in my solution. It's a DLL but shouldn't be reference (it's required for a 3rd party app). So on build I want this to be copied from _lib/ to bin/ but NOT referenced in the project.
I've included the _lib/ folder in my app, and for the properties of that DLL I selected always copy. This ALMOST worked, it copies the file with the folder, so my structure looks like:
/bin/_lib/thedll.dll
Instead of
/bin/thedll.dll
Any ideas?
Try following these steps in Visual Studio:
Expand the project tree concerned
Double click the Properties element
In the opened window click the Build Events tab
In the Post-build event command line text area place this:
xcopy "$(ProjectDir)_lib\file.ext" "$(ProjectDir)bin\$(ConfigurationName)"
Open the expected output folder alongside Visual Studio
Hit CTRL+Shift+B to make sure everything is saved and build
Feel the sense of achievement well up inside you as your file appears
:)
Oh, and you can now set Copy to output directory to Do not copy.

Categories