Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9233531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:34:32+00:00 2026-06-18T06:34:32+00:00

I recently started playing around with LuaInterface to get Lua scripting working in my

  • 0

I recently started playing around with LuaInterface to get Lua scripting working in my C# programs. In order to easily create Lua scripts from within Visual Studio, I installed a Lua syntax highlighting plugin and created an Item Template so that I could create new scripts by right clicking on the project file and selecting “New Item->Lua Script”. This works quite well.

In order for the program to find the scripts, they need to be placed in the same directory (or a subdirectory) of the build location. This is exactly where I want them, but in order to do this, I have to change the “Copy to Output Directory” setting for each new file I create.

Is there a way to change the default setting of this option? Right now it defaults to “Do not copy”. I could only find one other question asking essentially the same thing but the only answer provided there suggested a post-build event copying all files with the same extension to a defined location. I don’t really want to do this since the target destination may change or more targets may be added (and would require additional events?) and I would like to be able to change that setting on a per-file basis.

This is just a convenience issue, as I can change that option manually for each file, but having been able to automate the rest of the process, I was hoping I could automate this one last detail as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:34:33+00:00Added an answer on June 18, 2026 at 6:34 am

    You should be able to add an IWizard reference to the template, this will run when you click ok in the File -> Add window. You’ll need to add the assembly and type to the vstemplate file.

    Implement the RunFinished or possibly the ProjectItemFinishedGenerating method. You can then use the EnvDTE object exposed by Visual Studio to manipulate any item in the solution using the standard Visual Studio Extensibility model..

    The following code snippit (from the open source T4 Toolbox) shows how to set this property.

        /// <summary>
        /// Sets the known properties for the <see cref="ProjectItem"/> to be added to solution.
        /// </summary>
        /// <param name="projectItem">
        /// A <see cref="ProjectItem"/> that represents the generated item in the solution.
        /// </param>        
        /// <param name="output">
        /// An <see cref="OutputFile"/> that holds metadata about the <see cref="ProjectItem"/> to be added to the solution.
        /// </param>
        private static void SetProjectItemProperties(ProjectItem projectItem, OutputFile output)
        {
            // Set "Build Action" property
            if (!string.IsNullOrEmpty(output.BuildAction))
            {
                ICollection<string> buildActions = GetAvailableBuildActions(projectItem);               
                if (!buildActions.Contains(output.BuildAction))
                {
                    throw new TransformationException(
                        string.Format(CultureInfo.CurrentCulture, "Build Action {0} is not supported for {1}", output.BuildAction, projectItem.Name));
                }
    
                SetPropertyValue(projectItem, "ItemType", output.BuildAction);
            }
    
            // Set "Copy to Output Directory" property
            if (output.CopyToOutputDirectory != default(CopyToOutputDirectory))
            {
                SetPropertyValue(projectItem, "CopyToOutputDirectory", (int)output.CopyToOutputDirectory);
            }
    
            // Set "Custom Tool" property
            if (!string.IsNullOrEmpty(output.CustomTool))
            {
                SetPropertyValue(projectItem, "CustomTool", output.CustomTool);
            }
    
            // Set "Custom Tool Namespace" property
            if (!string.IsNullOrEmpty(output.CustomToolNamespace))
            {
                SetPropertyValue(projectItem, "CustomToolNamespace", output.CustomToolNamespace);
            }    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started playing around with Apache camel recently. So being the experimental type
I recently started playing around with writing Perl (v5.8.8) extensions using XS. One of
I started playing around with Haxe recently, after using AS3 for quite some time
I've recently started playing around with ASP.NET and I was just about to connect
I've recently started playing around with Specflow, and generating test cases based on the
I've recently started playing around with ncurses. As far as I understand, C doesn't
Recently started working with the scrapy library. I am trying to scrape from a
I have recently started playing around with iOS development and have got most of
I started playing with Angular.js recently, and got a demo project working pretty well.
I've recently started playing around with the Microsoft Visual Studio Team System Profiler. All

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.