diff options
author | Rob Mensching <rob@firegiant.com> | 2023-01-11 09:18:53 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2023-01-11 22:05:39 -0800 |
commit | 28b700be89603860f2127dc21170e8f413385602 (patch) | |
tree | 274acb77632465a4ca19ed880f5ea0dca9346a7c | |
parent | bc05ae6586f5e874a5802fcf06420a2ab2f6f06b (diff) | |
download | wix-28b700be89603860f2127dc21170e8f413385602.tar.gz wix-28b700be89603860f2127dc21170e8f413385602.tar.bz2 wix-28b700be89603860f2127dc21170e8f413385602.zip |
Customize project references to not attempt assembly reference resolution
Fixes 7132
-rw-r--r-- | src/wix/WixToolset.Sdk/tools/wix.props | 17 | ||||
-rw-r--r-- | src/wix/WixToolset.Sdk/tools/wix.targets | 43 |
2 files changed, 29 insertions, 31 deletions
diff --git a/src/wix/WixToolset.Sdk/tools/wix.props b/src/wix/WixToolset.Sdk/tools/wix.props index 0e0ed90e..b867ca8a 100644 --- a/src/wix/WixToolset.Sdk/tools/wix.props +++ b/src/wix/WixToolset.Sdk/tools/wix.props | |||
@@ -47,26 +47,9 @@ | |||
47 | </PropertyGroup> | 47 | </PropertyGroup> |
48 | 48 | ||
49 | <PropertyGroup> | 49 | <PropertyGroup> |
50 | <NoWarn>$(NoWarn);NU1702</NoWarn> | ||
51 | </PropertyGroup> | ||
52 | |||
53 | <PropertyGroup> | ||
54 | <AssetTargetFallback>$(AssetTargetFallback);net7.0-windows7.0;net7.0-windows;net7.0;net6.0-windows7.0;net6.0-windows;net6.0;net5.0-windows7.0;net5.0-windows;net5.0;netcoreapp3.1;netcoreapp3.0;netcoreapp2.0;net462;net47;net471;net472;net48;native</AssetTargetFallback> | ||
55 | </PropertyGroup> | ||
56 | |||
57 | <PropertyGroup> | ||
58 | <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute> | 50 | <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute> |
59 | </PropertyGroup> | 51 | </PropertyGroup> |
60 | 52 | ||
61 | <ItemDefinitionGroup> | ||
62 | <ProjectReference> | ||
63 | <Private>false</Private> | ||
64 | </ProjectReference> | ||
65 | <None> | ||
66 | <CopyToOutputDirectory>Never</CopyToOutputDirectory> | ||
67 | </None> | ||
68 | </ItemDefinitionGroup> | ||
69 | |||
70 | <ImportGroup> | 53 | <ImportGroup> |
71 | <Import Project="$(MSBuildUserExtensionsPath)\WixToolset\$(WixToolsetMajorMinorVersion)\Imports\WixToolset.props\ImportAfter\*" Condition="'$(ImportUserLocationsByWildcardAfterWixToolsetProps)' != 'false' and Exists('$(MSBuildUserExtensionsPath)\WixToolset\$(WixToolsetMajorMinorVersion)\Imports\WixToolset.props\ImportAfter')" /> | 54 | <Import Project="$(MSBuildUserExtensionsPath)\WixToolset\$(WixToolsetMajorMinorVersion)\Imports\WixToolset.props\ImportAfter\*" Condition="'$(ImportUserLocationsByWildcardAfterWixToolsetProps)' != 'false' and Exists('$(MSBuildUserExtensionsPath)\WixToolset\$(WixToolsetMajorMinorVersion)\Imports\WixToolset.props\ImportAfter')" /> |
72 | <Import Project="$(MSBuildExtensionsPath)\WixToolset\$(WixToolsetMajorMinorVersion)\Imports\WixToolset.props\ImportAfter\*" Condition="'$(ImportByWildcardAfterWixToolsetProps)' != 'false' and Exists('$(MSBuildExtensionsPath)\WixToolset\$(WixToolsetMajorMinorVersion)\Imports\WixToolset.props\ImportAfter')" /> | 55 | <Import Project="$(MSBuildExtensionsPath)\WixToolset\$(WixToolsetMajorMinorVersion)\Imports\WixToolset.props\ImportAfter\*" Condition="'$(ImportByWildcardAfterWixToolsetProps)' != 'false' and Exists('$(MSBuildExtensionsPath)\WixToolset\$(WixToolsetMajorMinorVersion)\Imports\WixToolset.props\ImportAfter')" /> |
diff --git a/src/wix/WixToolset.Sdk/tools/wix.targets b/src/wix/WixToolset.Sdk/tools/wix.targets index a4603c47..7e87064d 100644 --- a/src/wix/WixToolset.Sdk/tools/wix.targets +++ b/src/wix/WixToolset.Sdk/tools/wix.targets | |||
@@ -109,6 +109,21 @@ | |||
109 | <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences> | 109 | <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences> |
110 | </PropertyGroup> | 110 | </PropertyGroup> |
111 | 111 | ||
112 | <ItemDefinitionGroup> | ||
113 | <!-- Customize project references to not attempt assembly reference resolution. --> | ||
114 | <ProjectReference> | ||
115 | <Private>false</Private> | ||
116 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
117 | <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties> | ||
118 | <OutputItemType>_WixResolvedProjectReference</OutputItemType> | ||
119 | </ProjectReference> | ||
120 | |||
121 | <!-- By default do not copy none items to output. --> | ||
122 | <None> | ||
123 | <CopyToOutputDirectory>Never</CopyToOutputDirectory> | ||
124 | </None> | ||
125 | </ItemDefinitionGroup> | ||
126 | |||
112 | <PropertyGroup> | 127 | <PropertyGroup> |
113 | <!-- | 128 | <!-- |
114 | Only Package, Module and Bundle output types create .wixpdbs, so reset the flag indicating symbols will be produced outside of those output types. | 129 | Only Package, Module and Bundle output types create .wixpdbs, so reset the flag indicating symbols will be produced outside of those output types. |
@@ -268,7 +283,7 @@ | |||
268 | @(_MSBuildProjectReferenceExistent) - References to projects that exist. | 283 | @(_MSBuildProjectReferenceExistent) - References to projects that exist. |
269 | 284 | ||
270 | [OUT] | 285 | [OUT] |
271 | @(_ResolvedProjectReferencePaths) - Target paths from .vcxproj outputs added. | 286 | @(_WixResolvedProjectReference) - Target paths from .vcxproj outputs added. |
272 | ================================================================================================ | 287 | ================================================================================================ |
273 | --> | 288 | --> |
274 | <Target | 289 | <Target |
@@ -281,7 +296,7 @@ | |||
281 | Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform)" | 296 | Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform)" |
282 | Condition=" '@(ProjectReferenceWithConfiguration)' != '' and '%(_MSBuildProjectReferenceExistent.Extension)' == '.vcxproj' "> | 297 | Condition=" '@(ProjectReferenceWithConfiguration)' != '' and '%(_MSBuildProjectReferenceExistent.Extension)' == '.vcxproj' "> |
283 | 298 | ||
284 | <Output TaskParameter="TargetOutputs" ItemName="_ResolvedProjectReferencePaths" /> | 299 | <Output TaskParameter="TargetOutputs" ItemName="_WixResolvedProjectReference" /> |
285 | </MSBuild> | 300 | </MSBuild> |
286 | </Target> | 301 | </Target> |
287 | 302 | ||
@@ -289,23 +304,23 @@ | |||
289 | ================================================================================================ | 304 | ================================================================================================ |
290 | _ConvertResolvedProjectReferencesIntoWixConstructs | 305 | _ConvertResolvedProjectReferencesIntoWixConstructs |
291 | 306 | ||
292 | Converts _ResolvedProjectReferencePaths (which are the outputs of the ProjectReferences that | 307 | Converts _WixResolvedProjectReference (which are the outputs of the ProjectReferences that |
293 | normally would be passed through ResolveAssemblyReferences then be passed to the C# compiler | 308 | normally would be passed through ResolveAssemblyReferences then be passed to the C# compiler |
294 | as references) into the appropriate WiX constructs. For example, references to .wixlibs are | 309 | as references) into the appropriate WiX constructs. For example, references to .wixlibs are |
295 | converted into WixLibrary items. In the end, _ResolvedProjectReferencePaths is emptied to | 310 | converted into WixLibrary items. In the end, _WixResolvedProjectReference is emptied to |
296 | prevent ResolveAssemblyReferences and other non-sensical targets (from a WiX point of view) | 311 | prevent ResolveAssemblyReferences and other non-sensical targets (from a WiX point of view) |
297 | from doing work. | 312 | from doing work. |
298 | 313 | ||
299 | [IN] | 314 | [IN] |
300 | @(_ResolvedProjectReferencePaths) - Resolved project references. | 315 | @(_WixResolvedProjectReference) - Resolved project references. |
301 | $(VSProjectConfigurations) - map of project names to configurations, provided by VS when building in the IDE. | 316 | $(VSProjectConfigurations) - map of project names to configurations, provided by VS when building in the IDE. |
302 | 317 | ||
303 | [OUT] | 318 | [OUT] |
304 | $(ProjectReferenceDefineConstants) - Define constants from project references. | 319 | $(ProjectReferenceDefineConstants) - Define constants from project references. |
305 | @(BindPath) - Bind paths from project references. | 320 | @(BindPath) - Bind paths from project references. |
306 | @(WixLibrary) - Target paths from .vcxproj outputs added. | 321 | @(WixLibrary) - Target paths from .vcxproj outputs added. |
307 | @(_WixReferencedProjectOutputs) - Copy of _ResolvedProjectReferencePaths for use in up-to-date checks. | 322 | @(_WixReferencedProjectOutputs) - Copy of _WixResolvedProjectReference for use in up-to-date checks. |
308 | @(_ResolvedProjectReferencePaths) - All resolved reference paths emptied. | 323 | @(_WixResolvedProjectReference) - All resolved reference paths emptied. |
309 | ================================================================================================ | 324 | ================================================================================================ |
310 | --> | 325 | --> |
311 | <PropertyGroup> | 326 | <PropertyGroup> |
@@ -314,21 +329,21 @@ | |||
314 | <Target | 329 | <Target |
315 | Name="_ConvertResolvedProjectReferencesIntoWixConstructs" | 330 | Name="_ConvertResolvedProjectReferencesIntoWixConstructs" |
316 | DependsOnTargets="$(_CreateProjectDefineConstantsDependsOn)" | 331 | DependsOnTargets="$(_CreateProjectDefineConstantsDependsOn)" |
317 | Condition=" '@(_ResolvedProjectReferencePaths)' != '' "> | 332 | Condition=" '@(_WixResolvedProjectReference)' != '' "> |
318 | 333 | ||
319 | <!-- Save all the project reference outputs before we start removing --> | 334 | <!-- Save all the project reference outputs before we start removing --> |
320 | <ItemGroup> | 335 | <ItemGroup> |
321 | <_WixReferencedProjectOutputs Include="@(_ResolvedProjectReferencePaths)" /> | 336 | <_WixReferencedProjectOutputs Include="@(_WixResolvedProjectReference)" /> |
322 | </ItemGroup> | 337 | </ItemGroup> |
323 | 338 | ||
324 | <ItemGroup> | 339 | <ItemGroup> |
325 | <WixLibrary Include="@(_ResolvedProjectReferencePaths)" Condition=" '%(Extension)' == '.wixlib' " /> | 340 | <WixLibrary Include="@(_WixResolvedProjectReference)" Condition=" '%(Extension)' == '.wixlib' " /> |
326 | <_ResolvedProjectReferencePaths Remove="@(WixLibrary)" /> | 341 | <_WixResolvedProjectReference Remove="@(WixLibrary)" /> |
327 | </ItemGroup> | 342 | </ItemGroup> |
328 | 343 | ||
329 | <!-- Convert resolved project references into compiler defines and named and unamed bind paths --> | 344 | <!-- Convert resolved project references into compiler defines and named and unamed bind paths --> |
330 | <CreateProjectReferenceDefineConstantsAndBindPaths | 345 | <CreateProjectReferenceDefineConstantsAndBindPaths |
331 | ResolvedProjectReferences="@(_ResolvedProjectReferencePaths)" | 346 | ResolvedProjectReferences="@(_WixResolvedProjectReference)" |
332 | ProjectConfigurations="$(VSProjectConfigurations)"> | 347 | ProjectConfigurations="$(VSProjectConfigurations)"> |
333 | <Output TaskParameter="BindPaths" ItemName="BindPath" /> | 348 | <Output TaskParameter="BindPaths" ItemName="BindPath" /> |
334 | <Output TaskParameter="DefineConstants" PropertyName="ProjectReferenceDefineConstants" /> | 349 | <Output TaskParameter="DefineConstants" PropertyName="ProjectReferenceDefineConstants" /> |
@@ -339,7 +354,7 @@ | |||
339 | behavior from kicking in | 354 | behavior from kicking in |
340 | --> | 355 | --> |
341 | <ItemGroup> | 356 | <ItemGroup> |
342 | <_ResolvedProjectReferencePaths Remove="@(_ResolvedProjectReferencePaths)" /> | 357 | <_WixResolvedProjectReference Remove="@(_WixResolvedProjectReference)" /> |
343 | </ItemGroup> | 358 | </ItemGroup> |
344 | </Target> | 359 | </Target> |
345 | 360 | ||
@@ -358,7 +373,7 @@ | |||
358 | 373 | ||
359 | [IN] | 374 | [IN] |
360 | @(WixLibrary) - the list of .wixlib files. | 375 | @(WixLibrary) - the list of .wixlib files. |
361 | @(_ResolvedProjectReferencePaths) - resolved project references. | 376 | @(_WixResolvedProjectReference) - resolved project references. |
362 | $(WixLibrarySearchPaths) - optional search paths used to find .wixlibs. | 377 | $(WixLibrarySearchPaths) - optional search paths used to find .wixlibs. |
363 | 378 | ||
364 | [OUT] | 379 | [OUT] |