MsBuild: Do not compile referenced project
Asked Answered
P

1

6

I have the following project structure:

SLN
    libA
    libB (references libA)
    exeWPF (references libA and libB)

I use NAnt to compile libA and libB, with csc, but I cannot use csc with the WPF project, XAML targets cannot be compiled with NAnt, so I use a MSBuild task inside the NAnt project.

The problem is that when I launch a complete build, libA and libB are already by NAnt, and then when the MSBuild task is launched, the libA and libB libraries are compiled again, because the exeWPF csproj file references the libA and the libB projects.

An alternative could be instead referencing libA and libB as projects, I could reference them as dlls in the exeWPF csproj file. The problem is that in this case I loose the code and, navigate to reference.

The solution for me would be to be able to specify from the MSBuild task the references to the MsBuild project.

Pelisse answered 12/2, 2013 at 10:39 Comment(0)
I
10

You can build your exeWPF project like this

msbuild exeWPF.csproj /p:BuildProjectReferences=false

Property BuildProjectReferences will prevent MSBuild from building references, it will be forced to use pre-built assemblies to extract metadata for references, and it will fail if referenced assemblies don't exist.

Ifill answered 12/2, 2013 at 16:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.