Closed aelij closed 4 years ago
Typically you would just set the default target in the proj file itself.
Eg:
<Project ToolsVersion="14.0" DefaultTargets="Package" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets=";ValidateMSBuildFiles">
Yes, but that's exactly what I'm trying to avoid. Without this option, you'd have to customize the retail experience (VS) and try to come up with all sorts of conditions so it would only build these targets during traversal and not in VS.
Is there a downside to this suggestion? I think it would be pretty simple to implement.
I don't think it does customize the VS experience. VS still uses /t:Build
to build and so the default targets would not be run. The default targets would only run when calling MSBuild directly from the command-line, which is your scenario effectively.
Still, editing MSBuild project files directly deviates from the retail experience. If the build admin can provide an external dirs.proj
that allows developers to be oblivious to the underlying targets at play, that's a win in my book...
I think this is a good idea. I have a few questions:
dirs.proj
specified a target to build, that same project would build differently when building the project directly, is that okay?Build
target of the dirs.proj
. So if you did msbuild dirs.proj /t:Foo
, it would still run the Foo
target for every project. But if you did msbuild dirs.proj
or msbuild dirs.proj /t:Build
, it would run the custom target. Is that okay?IMO:
If a dirs.proj specified a target to build, that same project would build differently when building the project directly, is that okay?
Yes
So if you did msbuild dirs.proj /t:Foo, it would still run the Foo target for every project
I think this should be controllable somehow. Maybe using a property?
VS still uses /t:Build to build and so the default targets would not be run
I can say for certain that this is not always the case. For my ccproj
(on CBT), Visual Studio happily runs the Publish
target if specified in the DefaultTargets
(msbuild /t:build
does not).
Currently when specifying a
<ProjectFile />
for traversal, only the default targets are built. If we want to add other targets, we need to modify the project file, add conditions, etc.It would be very useful to be able to specify the targets directly in the traversal definition, e.g.: