Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, March 5, 2018 11:58 PM
I have some files that I would like copied to the solution's output directory, in the past one was able to right click on the file in the solution explorer and select properties - where there was an item for"Copy To Output Directory" - and even only copy if newer.
Now I have something like:
I have tried several values for the "Item Type" value but none of them result in the file being copied, I have both text files and binary files that I wish to have copied in the solutions output folder.
Is there no way to do this other than to have a batch file executed in the post build event (which I have found to be problematic)?
I am using:
Microsoft Visual Studio Community 2017
Version 15.6.0
VisualStudio.15.Release/15.6.0+27428.1
Microsoft .NET Framework
Version 4.7.02556
Installed Version: Community
Visual C++ 2017 00369-60000-00001-AA929
Microsoft Visual C++ 2017
Visual F# Tools 10.1 for F# 4.1 00369-60000-00001-AA929
Microsoft Visual F# Tools 10.1 for F# 4.1
Application Insights Tools for Visual Studio Package 8.11.10212.1
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2017 15.0.40214.0
ASP.NET and Web Tools 2017
Azure App Service Tools v3.0.0 15.0.40215.0
Azure App Service Tools v3.0.0
C# Tools 2.7.0-beta3-62620-07. Commit Hash: e873e69306527a0424e97af2985370556f474019
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Cookiecutter 15.6.18045.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
JavaScript Language Service 2.0
JavaScript Language Service
JavaScript Project System 2.0
JavaScript Project System
JavaScript UWP Project System 2.0
JavaScript UWP Project System
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.51212.2
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Python 15.6.18045.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Python - Django support 15.6.18045.1
Provides templates and integration for the Django web framework.
Python - IronPython support 15.6.18045.1
Provides templates and integration for IronPython-based projects.
Python - Profiling support 15.6.18045.1
Profiling support for Python projects.
R Tools for Visual Studio 1.3.40104.1351
Provides project system, R Interactive window, plotting, and more for the R programming language.
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools 15.6.20202.3
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 2.7.0-beta3-62620-07. Commit Hash: e873e69306527a0424e97af2985370556f474019
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake
Visual Studio Tools for Universal Windows Apps 15.0.27428.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
WiX Toolset Visual Studio Extension 0.9.21.62588
WiX Toolset Visual Studio Extension version 0.9.21.62588
Copyright (c) .NET Foundation and contributors. All rights reserved.
Thank you.
All replies (5)
Tuesday, March 6, 2018 7:12 PM ✅Answered
Thank you Viorel and Judy, you are correct and my recollection was incorrect - the ability to click on a file and use it's properties to have the file copied to the target directory was never there for C++ projects and came from my use of this feature in C# projects - the inconsistency is confusing.
Hello Darran, as to why I have found the use of batch files to be problematic you may look at thread HTML help compilation failing with: error MSB6006: "cmd.exe" exited with code 1 and similar ones with the same error.
Personally I find maintaining a batch file to be harder and less intuitive than using the properties tab for this and would prefer to have more consistency between projects.
I have made this suggestion to https://visualstudio.uservoice.com
Thank you.
Tuesday, March 6, 2018 6:13 AM | 1 vote
I think that it is displayed in case of C# or VB projects, when you select the file in Solution Explorer, then press <F4>.
This was not available in case of C++ projects, where you can use Custom Build Step or Build Events in the Project Properties dialog, providing a corresponding command like copy.
Tuesday, March 6, 2018 8:24 AM | 1 vote
Thanks for Viorel_’s reply.
Hi ellipsisware,
I check the property “Copy to Output Directory” in a C++ Windows Console Application use Visual Studio Community 2017, I can’t find it in Properties list.
Please have a try with Viorel_’s suggestion, write the custom build event inside the C++ project, and using the command line to implementation. More information, please refer to document “Understanding Custom Build Steps and Build Events”.
In addition, please take a look at following thread might helpful for you:
# Automatic copy files to output during application building
# Copying Visual Studio project file(s) to output directory during build
Regards,
Judyzh
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].
Tuesday, March 6, 2018 5:13 PM
What ways do you find using batch files problematic?
Using the command line parameters for the batch file and the Visual Studio macros, you should have everything you need to provide a batch file that is independent enough that it works wherever you load it from and independent of configuration.
If you have problems with batch files, you could use any scripting language that you are comfortable with too, since you should be able to execute powershell, and if you have any command line interpreters installed on these systems, perl, python or anything you want.
This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.
Wednesday, March 7, 2018 1:33 AM
Hi ellipsisware,
Glad you find the reason of your issue.
Please mark your reply as an answer, this will help other community members who encountered the same issue with you.
Thanks for your understanding.
Regards,
Judyzh
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].