I have a project in VS that doesn't have a .sln file in it, let's say it's a Java project (or any unmanaged code. However, I'd like to copy everything: the root folder and all of it's subdirectories over to another folder (eventually in the same domain) after Build. Is there an easier way to do this than include an empty .csproj and use MSBuild to copy?
The folder structure looks something like:
{Root}
|A
|C
|B
...
Related
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.
Is there anyway to keep CLion's project files (i.e. .idea directory) in a separate directory than the project? This feature already exists in IntelliJ IDE but I can't find something similar to CLion...
I'm looking for a structure like this one:
~/my_project/CMakelists.txt
~/my_project/other_source_files
~/project_files/my_project/.idea
I have a solution in VSS with this structure (simplified):
Solution1
|-Project1
|-Project2
|--Project2
|-Project3
You see the second Project2 folder?
Somehow it got inside that wrapping project2 folder.
How can I move painlessly all content of Project2 one level up,
so that I wont have Project2/Project2?
Thanks
You can try the steps below:
Backup the solution
Open VSS Explorer, move project2 folder
Open VS, go to File->Source Control->Change Source Control, update the server path of Project2
Save the solution.
I have a solution of about 50 projects.
I have most of those projects (the non-test ones) setup to output to a single folder.
I have heard that "copy local" can slow down build times (for project references), because it has to copy the file to everywhere it is referenced.
But if every project is copying to the same location is Visual Studio smart enough to see that the file is already there and not copy it again?
So, here is an example:
SolutionA
|
+---ProjectA (Output set to C:\MyProj)
|
+---ProjectB (Output set to C:\MyProj)
| References ProjectA
|
+---ProjectC (Output set to C:\MyProj)
| References ProjectB
|
+---ProjectD (Output set to C:\MyProj)
References ProjectA
In a normal solution, copy local would control the copy of the reference to the bin\Debug folder for each of these projects.
But I have updated the "Output" section of the Project Properties so that they all drop to C:\MyProj instead of bin\Debug.
If I do not set Copy Local to false for references, will ProjectA.dll be copied to C:\MyProj four times? Or is Visual Studio smart enough to only do it once?
I think what you are asking is "does it take any time to copy a file onto itself?" As you might expect, it doesn't. You can see this by using Reflector or ILSpy on the Microsoft.Build.Tasks assembly, the Copy class performs the copy. Its DoCopyIfNecessary() method contains this line of code:
if (string.Compare(sourceFileState.Name, destinationFileState.Name, StringComparison.OrdinalIgnoreCase) != 0)
{
flag = this.DoCopyWithRetries(sourceFileState, destinationFileState, copyFile);
}
Or in other words, it skips the copy if the source and destination file are the same. Necessarily so, File.Copy() won't be happy.
Copy Local copies to the bin directory. Usually Visual Studio will empty this directory on a Clean command. If you don't set Copy Local, you run the risk of not having all your references in the bin folder(s).
You can copy them to the bin folder in another way I suppose; but you'd have to do that manually if you ever run Clean...
As far as I know, VS isn't smart enough to see that each project has the same bin directory, so it would copy four times (test and verify though). In the above scenario you could have only one project with Copy Local and avoid this. But, you'll need at least one with Copy Local otherwise you'll have situations where your bin directories won't have the file otherwise.
I have a project that is stored in a Subversion repository.
In this repository, in a different folder, I have a set of libraries that I use in many of my projects. These libraries are stored as binary files, ie. the dll's, pdb's, and xml's.
Here's an example layout:
<repo-url>
\Libraries
\SQLite
\SystemHooks
\Moq
In the application project, I add a "libs" directory, then add a svn:externals reference property to that directory to pull in the libraries I need.
For instance, for this project I am working on now, which prompted this question, I need the SystemHooks library, so in my app project folder structure, it now looks like this:
SketchingMode <-- solution folder, other projects here as well
SketchingMode <-- app project folder
libs
SystemHooks
The nice thing about this is that I can more easily update the libraries, and just use the -rXYZ specifier for the externals definition to avoid pulling in newer versions than I'm ready to accept, and still have only one copy of each file/version in my repository.
The bad thing, in this particular case, is that one of the dll's in the SystemHooks directory (2 if I want the pdb as well) needs to be copied to the output directory, not referenced by the project.
References work as normal, but once I tag one of the files in this directory as "Content" and "Copy always" or "Copy if newer", then the libs and SystemHooks directory structure is also copied to the output directory.
As such, after a build, my on-disk directory structure looks like this:
SketchingMode <-- solution folder, other projects here as well
SketchingMode <-- app project folder
libs
SystemHooks
bin
Debug <-- main build output here
libs
SystemHooks <-- 1-2 files in here
Is the only way to avoid this to use the post-build steps and just add the necessary copy statements? Or can I somehow tweak the project file to avoid copying the full structure like that?
Just to make it clear, in the bin\Debug directory, I don't want another layer of libs\SystemHooks in there, and all the files presently being copied to the bin\Debug\libs\SystemHooks folder needs to be copied to the bin\Debug folder instead.
How about checking out the libs directory to the level of the solution rather than the project? That is what we do since library assemblies tend to be used by multiple projects; placing direct inside one project's directory would not make for a highly shareable resource.
SketchingMode solution
SketchingMode proj
bin
Debug
Release
Libs
SystemHooks