Visual Studio script project

I would like to create a super simple VS2010 project that will generate a file using a batch script. This project will be needed as a dependency for another. Is there an easy way to do this?

+3


source to share


1 answer


Good question, Don. You can create a new directory in your solution and place your script there. Then you will create an MSBuild script named MyProject.csproj as shown below:
<?xml version="1.0" encoding="utf-8"?>
<Project
    ToolsVersion   = "4.0"
    DefaultTargets = "Build"
    xmlns          = "http://schemas.microsoft.com/developer/msbuild/2003"
    >
    <ItemGroup>
        <InputTxt  Include="$(MSBuildProjectDirectory)\input.txt" />
        <OutputTxt Include="$(MSBuildProjectDirectory)\output.txt" />
        <Script    Include="$(MSBuildProjectDirectory)\script.cmd" />
    </ItemGroup>
    <Target
        Name    = "Build"
        Inputs  = "@(InputTxt);@(Script)"
        Outputs = "@(OutputTxt)"
        >
        <Exec Command = '"@(Script)" "@(InputTxt)" "@(OutputTxt)"' />
    </Target>
</Project>

      



+2


source







All Articles