How does Eclipse handle excluding Java files in the project??
In C# the list of files in the project is handled in the sln file - There seems nothing similar in Eclipse!!
Any ideas?
In Visual Studio files for C# projects are stored in the .csproj files. Solutions are just containers for projects (which can be C#/C++/VB/... projects).
The last time I worked with Eclipse all files beneath the project's root were automatically included. When one was excluded from the build the project's .classpath file was modified:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="ExcludedFile.java" kind="src" path="src"/>
<!-- ... other entries ... -->
</classpath>
You can exclude a file in Eclipse by right-clicking it in the Package Explorer and then choosing Build Path -> Exclude.
Project specific meta information (like this) is stored in either the .project or the. .classpath files in the root of the project. These are hidden in the project view, but visible in the navigator view.
You shouldn't need to directly edit the .project and .classpath files mentioned in the other answers. As with Visual Studio, the IDE generates and owns these project meta data files for you.
For example, you can exclude an individual java file from the build path by right clicking on it in the project explorer and selecting "Build path / Exclude". That will make the required .classpath changes for you.
Related
I have a WPF project that is now finished, and I want to publish the app into an installer that other people can use.
When I publish the project, the project compiles into setup.exe, but on install the folders that I have do not get included.
I've been reading the guides, and made sure to include the files inside the folders as Content or a Resource. I've also made sure they are always copied. When some of my files are copied, they have a .deploy extension, and I need it to be an .xml in order for some function to read them. Images that I have in the app load fine however.
What do I need to do to have my custom files be EXACTlY as they are, xml as xml, txt as txt and so on. Also I have some empty folders, like this TempCF that I use at some point. Do i need to create it via code?
If you go to Project->Properties->Publish->Install Mode and Settings->Options->Deployment in Visual Studio, there is a "Use ".deploy" file extension" option that you can untick to get rid of the .deploy extension being added to your published files:
Empty project folders are not included in the output. Either put a dummy content file in them or create the folder dynamically as needed during runtime.
# Nikola L.
You could try to use the following methods to add the files in your program to the installation package so that you can have the files you need in your installation path. If I misunderstood your question, please let me know.
The steps are as follows:
1.Right-click on the Setup project and select View -> File System
2.In the File System page, right-click the Application Folder (File System on target Machine) and select Add->Folder(named User's Application Data ) -> Fileā¦-> find the file under your project and select the file you need.
Such as:
3.Right-click the Setup project.
Install your setup package.
You can find the files you added in your installation path.
The result is like the picture below:
I am trying to create an application for File management system.
This is how project structure should look like:
I have managed to download needed files from GitHub:
Is there any guide how to add them all to Visual Studio Project to get it working?
There is VaultApplication.cs in src folder.
Move the files to your project's folder, then, right-click on the project node (MyCompany.MyProduct.MyVaultApplication1). Select Add>Existing Items. And then add the files and folders you just moved.
Edit: as pointed out in the comments, moving the files to your project's folder isn't 100% necessary, but I think it makes things easier to manage.
Is there a way to build solution into a single folder? I have several projects in this solution and each access a config file that should be in the current directory. I just move each project's build files into one and it still works, however, it looks so unorganized and messy. I just want to know it there are other ways on how to do it.
You can set output directory in the settings of every project in solution (if we are about Visual Studio). Menu: Project -> properties -> Build -> Output path. For example, I use ..\Build\ to build projects into Build directory of solution root.
This MSDN article explains how to do it in a nice, DRY way:
https://blogs.msdn.microsoft.com/kirillosenkov/2015/04/04/using-a-common-intermediate-and-output-directory-for-your-solution/
It allows you to specify those directories only once, and use those settings in multiple projects.
Steps:
Create a single common.props file in solution, that will specify and overwrite output and intermediate paths for a project to a common directory (like "Solution/bin").
Here is a sample *.props file that I found linked in the article:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
<OutputPath>$(SolutionDir)\bin\$(Configuration)\</OutputPath>
<OutDir>$(OutputPath)</OutDir>
<OutDir>$(OutputPath)</OutDir>
<IntermediateOutputPath>
$(SolutionDir)\obj\$(Configuration)\$(MSBuildProjectName)\
</IntermediateOutputPath>
<UseCommonOutputDirectory>False</UseCommonOutputDirectory>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
</Project>
Include this file into every *.csproj that you want to set the common output dirs for, by adding this line (the actual path may differ): <Import Project="..\Common.props" />
You can change projects "Output path", by default it's bin directory of given project.
Right click on each project, select Properties from context menu, then select Build tab.
Ont the bottom in Output section change Output path:. Set same path for each project.
I agree with comments under your question, you should not change it. Instead you may create post build action (PS script) that will copy all files from project's bin directories to one designated by you.
Update:
Set this script as Post Build command (Project's properties->Build Events tab->Post build event command line):
xcopy "$(TargetDir)*" "$(SolutionDir)Build" /s /i /Y
For each project:
Go into the project properties, in the "Build" tab.
Choose "All configurations", "all platforms", just in-case.
In the output folder write "..\bin\" (or any path which is uniform for all of them - not in the current project directory). Alternatively, to organize DLLs in sub-folders you can write "..\bin\Sub-project-directory" in the output path. Then you should add an App.config file for the EXE project with a probing to all DLLs so they can be found and loaded on runtime.
Note that if we're talking about building multiple executables into the same output directory, you can also add them as project references to the main (startup) project. They will be automatically copied to the main project output directory everytime you build it.
(note: this applies to .NET Core projects in VS 2017 or VS 2019. I'm not sure if it would work for .NET Framework projects)
I have some library files needed for my application to work.
My application has a setup and deployment included.
I already know that in order for a library file to be added to the output directory of the application when installing, I just have to reference those libraries inside the .NET IDE before building... the only problem is that these libraries can't be referenced... So I need to be able to copy these libraries to the installation directory of my application... At the moment, I am copying these libraries manually...
Addendum
I also did try to add these library files as an Existing Item to my project and marked each library files' Copy to Output Directory to Copy if newer on their properties but still not getting the solution I want.
Update 1
Thanks for you help guys it helped me solve my problem, I managed to make the solutions you posted work except for one... #Matthew Watson's post.. I even managed to find a solution too so I wanted to share it with you also.
Heres what I did:
I opened the setup and deployment project in my application.
Under the Application Folder Tree, on it's right side, I right clicked..
then clicked Add..
then clicked File
and then browsed for the files I wanted to add to the installation directory
and click open.
But out of curiosity...I am still trying to make what #Matthew Watson posted work...
Update 2
I forgot to update this post yesterday, I already manage to make Matthew Watson's solution worked yesterday. Thank you again for all your help guys.
You can add files to your project and select their properties: "Build Action" as "Content" and "Copy to output directory" as "Copy Always" or Copy if Newer (the latter is preferable because otherwise the project rebuilds fully every time you build it).
Then those files will be copied to your output folder.
This is better than using a post build step because Visual Studio will know that the files are part of the project. (That affects things like ClickOnce applications which need to know what files to add to the clickonce data.)
You will also be more easily able to see which files are in the project because they will be listed with the source code files rather than hidden in a post-build step. And also Source Control can be used with them more easily.
Once you have added "Content" files to your project, you will be able to add them to a Visual Studio 2010 Setup and Deployment project as follows:
Go into your Setup project and add to your "Application Folder" output the Project Output called "Content Files". If you right-click the Content Files after adding them you can select "outputs" and see what it's going to copy.
Note that Setup and Deployment projects are NOT supported in Visual Studio 2012.
You can use Visual Studio Post Build Event - Copy to Relative Directory Location. Which are basically scripts that are executed on build of specified project.
So you can use it to copy binaries you need, before actually running your application.
I have a Silverlight 4 app that I'm building with Visual Studio 2010. I'm using Mercurial/TortoiseHG to do version control. Which files do I need to check in? By default, it checks in all sorts of .dlls in /bin/debug and stuff. Do I really need those? Or can I just grab code and content files? Do I need to version something to keep track of project properties and references, or is that contained within the .csproj file itself?
You don't need to include stuff in /bin or /obj. This is true of all VS solutions in source control. These are recreated upon every rebuild. Also, for Silverlight specifically, you don't need to check in the XAP file that is generated in the ClientBin of your web app.
From MSDN (via this social.msdn thread):
You can add the following files to Visual Studio source control:
Solution files (*.sln).
Project files, for example, *.csproj, *.vbproj files.
Application configuration files, based on XML, used to control run-time behavior of a Visual Studio project.
Files that you cannot add to source control include the following:
Solution user option files (*.suo).
Project user option files, for example, *.csproj.user, *.vbproj.user files.
Web information files, for example, *.csproj.webinfo, *.vbproj.webinfo, that control the virtual root location of a Web project.
Build output files, for example, *.dll and *.exe files.
It doesn't say anything specific about Silverlight projects though.
Is Mercurial/TortoiseHG integrated into Visual Studio? i.e. can you check out/submit from within VS?
If so, if you right click on the project name and select "Add Solution to Source Control" it should add those parts of the project that it needs ignoring everything else.