Search code examples
.netmsbuildasp.net-corednxdnu

DNU publish --no-source from MSBuild


Is it possible to invoke dnu publish with the --no-source attribute from MSBuild when triggering the FileSystemPublish target?

MSBuild command:

/t:Build,FileSystemPublish /p:PublishConfiguration=$(BuildConfiguration) /p:PublishOutputPathNoTrailingSlash=$(build.stagingDirectory)

MSBuild ultimately calls the following:

dnu publish "C:/MyApplication" --out "C:/a/MyApplication" --configuration Release --runtime dnx-clr-win-x86.1.0.0-beta6 --quiet

I would like to append the --no-source attribute.


Solution

  • you can pass /p:compileSource=true to set the --no-source option during dnu publish.

    (Also, you don't have to use the specific publish target FileSystemPublish, you can set the msbuild property /p:deployOnBuild=true to publish after build.)