Netbeans: move a text file into dist folder when compiling - compilation

I have a text file (let's say textfile.txt) stored in the project folder in Netbeans 7.3, e.g.
project folder
textfile.txt
src
package
package.subpackage
MyClass.java
When I compile I get a dist folder where the jar file is put in, e.g.
project folder
textfile.txt
dist
MyProject.jar
src
package
package.subpackage
MyClass.java
How can I edit the build.xml file to make the file textfile.txt being copied under dist folder?

Edit the "-post-compile" target inside the build.xml as follows:
<target name="-post-compile">
<copy file="textfile.txt" todir="${dist.dir}"/>
</target>

Related

Visual Studio 2019 set output directory for .tlog and .dll.recipe file

I have a project in Visual Studio and want all files generated during build under the build\ subdirectory.
I set all output options I could find but there is still a Debug\ folder created with the files: projectname.dll.recipe and subfolder projectname.xxxx.tlog which contains .tlog and .lastbuildstate files.
I know the .tlog files are from the MSBuild File Tracker, know idea what the .dll.recipe is.
How can I set the output directory for those files to $(OutDir)?
You can try the following steps:
Function 1
Open your project in VS IDE and then right-click on the project Properties-->Configuration Properties-->General--> change Intermediate Directory to ..\$(Configuration).
Then, rebuild your project to get what you want.
Function 2
1) add a file called Directory.Build.props in your solution folder like this:
2) add these content in the Directory.Build.props:
<Project>
<PropertyGroup>
<IntDir>..\$(Configuration)\</IntDir>
</PropertyGroup>
</Project>
3) close VS Instance, delete any Debug folder in your solution folder.
Then restart VS(enable the function of the Directory.Build.props) to open your solution to build again and the files will be under the $(OutDir) path.

Copy app.publish folder in VSTS Build/Release

Similar to the question here: Copy one file in target directory on deploy from visual studio team services, I am trying to copy the contents of the app.publish directory of a ClickOnce application via VSTS build/release.
This is the Copy Publish Artifact step of the Build
This obviously outputs everything in the bin folder to the drop folder on the server share.
This is the Copy Files step of the Release
This copies only the files in the app.publish folder but it builds out the entire hierarchy to the folder app.publish folder; however, it builds out the full folder structure. i.e. bin\Release\app.publish or bin\Debug\app.publish.
I like the idea of being able to publish and store different configurations (debug/release) but I don't like that I'm having to specify the InstallUrl in the msbuild arguments in order to pick up debug/release in the folder path. Even if I didn't try to maintain multiple configurations, the configuration would still be in the path.
So my question is: Is there a way to use the copy files task to just copy the app.publish folder and/or the contents to another location, without it creating the full hierarchy?
You need to specify the copy root in Source Folder of Copy Files, in your example, the copy root should be like:
Source Folder: $(System.DefaultWorkingDirectory)\$(Build.DefinitionName)\bin\$(BuildConfiguration)\
Contents: **\app.publish\**
In this way, you should only have app.publish in your Target Folder.
Configure the "Copy Root" of "Copy Publish Artifacts" step in your build definition to the path of build configuration folder and "Content" to "**".
For example, if the path of your build output is:
C:\a\1\s\SolutionFolder\ProjectFolder\bin\Relase\app.publish...
You can set the Copy Root to:
$(build.sourcesdirectory)\SolutionFolder\ProjectFolder\bin\$(BuildConfiguration)
And Content set to:
**

Build from a Solution folder into a specific subfolder of the output folder

I know how to move built .dlls to a folder using post-build events to copy the files, or using the output path setting.
Can I do something like that for all projects in a solution folder, where I wouldn't need to set up build events. I want all projects in a solution folder "SomeDir" to be moved to a "SomeDir" folder when built.
"SomeDir" would be the subfolder of the main output folder
Thanks

VS 2010, change location of project file

I do not with VS 2010 frequently so my question is "beginner".
VS2010 creates a solution with the folowing directory structure (simplified):
/Solution
solution.sdf
solution.sln
solution.suo
/Solution
solution.cpp
solution.vcxproj
/Debug
/Release
I want to change the directory structure for alredy created project:
/Solution
/Solution
solution.cpp
/Projects
/VS
solution.sdf
solution.sln
solution.suo
solution.vcxproj
/Debug
/Release
So the solution file and projects file will be moved into subfolder
/Projects/VS
The file solution.sln was enough to edit the path to
= "Solution", "..\..\solution.vcxproj"
But how (and where) to change a location of the project file solution.vcxproj so as to be able to locate all files with the source code.
I am using different compilers so I want to create own subfolder for each development tool.
/Projects
/VS
/Eclipse
...
= "Solution", "..\..\solution.vcxproj"
No that's wrong, the .sln file is in the same folder as the .vcxproj file. So it should read = "Solution", "solution.vcxproj".
The only other patch is that the solution.cpp file is in a non-standard location. Edit the .vcxproj file and locate the <ItemGroup> for the solution.cpp file. Change it to Include="..\solution.cpp".

Exclude .svn from _bin_deployableAssemblies directory?

In VS 2010 for ASP.NET MVC 3 project there is an option to add a "Deployable Dependencies" folder (_bin_deployableAssemblies) (click right button on web project), files contained in this directory will be copied to the /bin directory.
If you are using Subversion, this task will also try to copy .svn folder and its content, which will result in an error due to a collision with /bin 's own .svn folder.
Question: how do you exclude .svn folder from being copied to /bin?
Following seems to do the trick:
backup and open file Microsoft.WebApplication.targets (on my computer found in C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications)
find target named _CopyBinDeployableAssemblies
in that task find line:
.
<CreateItem
Include="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\**\*.*"
Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
and add Exclude attribute as follows:
<CreateItem
Include="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\**\*.*"
Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')"
Exclude="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\**\.svn\**\*">

Resources