MSBuild treating Content files differently in different environments - visual-studio-2010

I have a project with a structure like this:
> Project
> App
> Config
> File1.json
> File2.json
File1.json and File2.json are marked as Content, copy if newer.
When I build/publish using Visual Studio, the output is:
> bin
> App
> Config
> File1.json
> File2.json
When the project is built from the command line, the output is
> bin
> File1.json
> File2.json
Any idea why this would be? I need to be able to reference these files in a known location, so this is something of a problem.
Thanks!

You could configure your output path in Properties
Right click Project -> Properties -> Build -> Output Path
Or you could manually edit it in the .csproj file
<OutputPath>myOutputLocation\myBin\</OutputPath>

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.

TFS - Creating a "sandbox" project within a solution

I have a solution with the following structure:
> SolutionA
> ProjectA
> FolderA
> FileA
> FileB
> FolderB
> ProjectB
> FolderC
> FileC
I have a developer who wants to play with some testing scenarios and who only needs to be exposed to FileA and FileC. What I would like to do is the following:
> SolutionA
> ProjectA
> FolderA
> FileA
> FileB
> FolderB
> ProjectB
> FolderC
> FileC
> SandboxProject
> FolderA [link]
> FileA [link]
> FolderC [link]
> FileC [link]
> FolderSandbox
> FileSandbox
I'd like to add SandboxProject to achieve the following:
Provide the developer access to source-controlled files without exposing him to things he doesn't need to know about - these files aren't independent enough to be in their own projects, but he doesn't need to know about other siblings. This is both a security (sensitive files) and dev UX concern (don't show more than necessary).
Provide an easy way to play with the consumers of the linked files (for example - a linked file might be plugin.js but he will make his own Index.cshtml to consume/test it. His changes to plugin.js will be seen in the original project as it's just a link to a source-controlled file. Changes to Index.cshtml won't impact other projects because it's source-controlled within SandboxProject only.
Does Visual Studio / VSTS support this kind of "linking" and isolation? If so, what steps should be taken to achieve it? Can I use Add as link for this purpose?
No, it is not supported.
Regarding Add as link, the target files must be downloaded to a machine (can be in a shared folder), also these files need to be accessible. So, I don’t think it meets your requirements.
The better way is that, you can package necessary files/project and publish to VSTS/TFS feed, then developers can add these packages reference.
Note: With this way, the changes to package files won’t affect the source files. But since the developer don’t know about the things of the source files, the changes in “linked” files shouldn’t affect the source files.
More information about vsts/tfs feed, you can refer to: Package Management in Team Services and TFS.

Build system for .cpp files : run make.bat in the same folder

How to make that CTRL+B (Build) automatically launches the make.bat file in the same folder, when editing a .cpp file in Sublime Text?
Note: I've found Tools > Build system > New build system but I haven't achieved to do it yet.
It works with this C++.sublime-build in C:\Users\<User>\AppData\Roaming\Sublime Text 2\Packages\C++ (Windows 7) :
{
"cmd": ["$file_path\\make.bat"]
}

How do I set VS2010 project properties in CMake?

For example, in my vs2010 project file, I have "Output File Name" (from Project Properties -> C/C++ -> Output Files) to $(IntDir)/%(RelativeDir)/. I know how to do this manually, but for CMake I'm not at all sure.
How do I set such a property, in the CMakeLists.txt file?
When you do add_executable() or add_library(), the target name is the name of resulting binary, which, i think, will turn into "Output File Name" property during generation.
You can also try to set OUTPUT_NAME property for your target.

What are "Content Files" (in Visual Studio : Setup Project : File System

In the context of a Visual Studio 2008 Setup Project, what are "Content Files". In other words, when creating a setup project and defining the File System settings and choosing: Add Project Output > Content Files, what files will be added?
For example, what has to be true about a file or its location for it to be considered a Content File for a given project's output?
The build action property of the file will be labeled "content". Here is a link to more information about File Properties.

Resources