Reputation: 21855
I have a csproj loading fine with the following lines (it is an VSTO project file):
...
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}">
<ProjectProperties HostName="Word" HostPackage="{20A848B8-E01F-4801-962E-25DB0FF57389}" OfficeVersion="14.0" VstxVersion="4.0" ApplicationType="Word" Language="cs" TemplatesPath="VSTOTemplates" DebugInfoExeName="#Software\Microsoft\Office\15.0\Word\InstallRoot\Path#WINWORD.EXE" DebugInfoCommandLine="/w" AddItemTemplatesGuid="{51063C3A-E220-4D12-8922-BDA915ACD783}" />
...
Due to some reasons I want to set the HostPackage property of the ProjectProperties from a variable, not hardcoded so I replaced the lines with:
...
<PropertyGroup>
<HostPackageValue>{20A848B8-E01F-4801-962E-25DB0FF57389}</HostPackageValue>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}">
<ProjectProperties HostName="Word" HostPackage="$(HostPackageValue)" OfficeVersion="14.0" VstxVersion="4.0" ApplicationType="Word" Language="cs" TemplatesPath="VSTOTemplates" DebugInfoExeName="#Software\Microsoft\Office\15.0\Word\InstallRoot\Path#WINWORD.EXE" DebugInfoCommandLine="/w" AddItemTemplatesGuid="{51063C3A-E220-4D12-8922-BDA915ACD783}" />
...
As far as I know this should work the same as there are no real changes on the code but for some reason I am getting the following error when I try to reload the project
The operation could not be completed. The parameter is incorrect (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Any insight about what can be the cause?
Upvotes: 0
Views: 167
Reputation: 76770
Any insight about what can be the cause?
That because anything inside of a ProjectExtensions element will be ignored by MSBuild, so we could not use MSBuild to replace the hardcoded value with a property.
See ProjectExtensions Element (MSBuild) for the detailed info.
Upvotes: 1