Skip to content

Commit

Permalink
fix: Changed WorkingDirectory to $(OutDir) as default and $(OutputPat…
Browse files Browse the repository at this point in the history
…h) as fallback (#223)

* Changed the WorkingDirectory parameter of the exec call to dscom to use $(OutDir) as default and $(OutputPath) as fallback.

$(OutputPath) might not work on large complex solutions.

See https://github.com/dotnet/msbuild/blob/f914c9bfb613d32edb658b803c7fe046f9ee3c37/src/Tasks/Microsoft.Common.CurrentVersion.targets#L107-L122

'OutDir and OutputPath are distinguished for legacy reasons, and OutDir should be used if at all possible.'

* Quotation marks added for calling the dscom tool on paths containing spaces
  • Loading branch information
Brimerland committed Dec 12, 2023
1 parent b90856c commit 9d28203
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,23 @@
<_DsComArguments> $(_DsComArguments) $(_DsComAssemblyReferences)</_DsComArguments>
<_DsComArguments> $(_DsComArguments) $(_DsComTypeLibraryReferences)</_DsComArguments>
<_DsComArguments> $(_DsComArguments) $(_DsComTypeLibraryReferencePaths)</_DsComArguments>
<_DsComArguments> $(_DsComArguments) $(_DsComExportTypeLibraryAssemblyFile)</_DsComArguments>
<_DsComArguments> $(_DsComArguments) "$(_DsComExportTypeLibraryAssemblyFile)"</_DsComArguments>
<_DsComArguments> $(_DsComArguments) $(_DsComAliasNames)</_DsComArguments>
<_DsComArguments Condition="'$(DsComOverideLibraryName)' != ''"> $(_DsComArguments) --overridename "$(DsComOverideLibraryName)"</_DsComArguments>
<_DsComArguments> $(_DsComArguments) --out "$(_DsComExportTypeLibraryTargetFile)"</_DsComArguments>
<_DsComWorkingDir>$(OutDir)</_DsComWorkingDir>
<_DsComWorkingDir Condition="$(_DsComWorkingDir) == ''">$(OutputPath)</_DsComWorkingDir>
</PropertyGroup>

<Message Importance="High" Text="Calling dscom.exe to export type library" />
<Message Importance="Low" Text="Using arguments '$(_DsComArguments)' to call dscom" />

<Exec Command="$(_DsComToolsFileDir)dscom.exe $(_DsComArguments)"
<Exec Command='"$(_DsComToolsFileDir)dscom.exe" $(_DsComArguments)'
ConsoleToMsBuild="true"
StdErrEncoding="UTF-8"
StdOutEncoding="UTF-8"
IgnoreExitCode="false"
WorkingDirectory="$(OutputPath)" />
WorkingDirectory="$(_DsComWorkingDir)" />

<Warning Code="DSCOM001" Text="Could not find the type library at the following location: '$(_DsComExportTypeLibraryTargetFile)'" Condition="!Exists('$(_DsComExportTypeLibraryTargetFile)')" />
</Target>
Expand Down

0 comments on commit 9d28203

Please sign in to comment.