Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have created a build task that dynamically generates a file for the project it's used in. I've managed to get that file to be copied into the $(TargetDir), but not into the AppX folder. The reason I need it there is, that this build task is about unit tests and this file is needed inside the tests.

Sounds a bit confusing so I try to clarify a little:

I generate code in that task and compile that into an assembly which I add as a reference to the main assembly (in this case the test.dll). So what happens is that I do this after the "AfterCompile" target and my assembly gets generated into the obj\Debug folder. This is my Target:

<UsingTask TaskName="MyBuildTask" AssemblyFile="MyBuildTask.dll"/>

<Target 
    AfterTargets="AfterCompile"
    Name="MyBuildTarget">
    <MyBuildTask
        SolutionRoot="$(SolutionDir)"
        GeneratedAssemblyPath="$(IntermediateOutputPath)$(TargetName).Generated.dll"
        TestProjectPath="$(ProjectPath)"
        TestAssemblyPath="@(IntermediateAssembly)"
    >
        <Output TaskParameter="GeneratedFile" ItemName="GeneratedFile"/>
    </RosMockLyn.Build.MockBuildTask>
    <ItemGroup>
        <Content Include="@(GeneratedFile)">
            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
            <DeploymentContent>true</DeploymentContent>
        </Content>
    </ItemGroup>
</Target>

One this, that I also don't want is, that this file now gets copied to \bin\Debug\obj\Debug.

I could obviously specify this statically, so that it's always copied to the output path root and then to the AppX folder, I only want to do this as my last solution if there is nothing else I can do.

So how do I get my file into this GetCopyToOutputDirectoryItems, which I presume is the list of items that are both for the output directory and the AppX package?

share|improve this question

1 Answer 1

Have you tried removing the $(IntermediateOutputPath) from the GeneratedAssemblyPath, I believe that is what is producing the \bin\Debug\obj\Debug. It is copying that file path into the OutputDirectory (which is generally something like \bin\Debug.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.