Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio script project

What I would like to do is create a super-simple VS2010 project that would generate a file using a batch script. This project will be necessary as a dependency for another. Is there a simple way of doing this?

like image 830
Don Reba Avatar asked Oct 05 '22 02:10

Don Reba


1 Answers

Good question, Don. What you could do is create a new directory in your solution and place your script there. You would then create an MSBuild script called MyProject.csproj like the following:

<?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>
like image 100
Don Reba Avatar answered Oct 13 '22 11:10

Don Reba