@joebigelow / wix / commits / a6d943fc

Detect when Restore is required for a .wixproj to build

Closes 6701

Rob Mensching committed Jul 6, 2022 at 10:21 UTC a6d943fc8366ff8135d3a15960da4edaf10e0094
1 file changed +23 -1
src/wix/WixToolset.Sdk/tools/wix.targets
+23 -1
@@ -215,6 +215,7 @@
215 <ResolveReferencesDependsOn>
216 BeforeResolveReferences;
217 AssignProjectConfiguration;
218 + _ValidateProjectAssetsFile;
219 ResolveProjectReferences;
220 FindInvalidProjectReferences;
221 ResolveNativeProjectReferences;
@@ -226,6 +227,27 @@
227 </ResolveReferencesDependsOn>
228 </PropertyGroup>
229
230 + <!--
231 + ================================================================================================
232 + _ValidateProjectAssetsFile
233 +
234 + Ensures that the project assets file exists which indicates restore was completed. Restore is
235 + required if there are any PackageReferences in the project.
236 +
237 + [IN]
238 + @(PackageReference) - Package references, if any.
239 + $(ProjectAssetsFile) - Project assets file that should be created during restore.
240 + ================================================================================================
241 + -->
242 + <Target
243 + Name="_ValidateProjectAssetsFile"
244 + Condition=" '@(PackageReference)' != '' ">
245 +
246 + <Error Text="The $(ProjectAssetsFile) file does not exist. Restore the project before trying to build again. Restore and build with &quot;MSBuild -Restore&quot; or &quot;dotnet build&quot;."
247 + Condition="!Exists('$(ProjectAssetsFile)')" />
248 +
249 + </Target>
250 +
251 <!--
252 ================================================================================================
253 _WixUpdateProjectReferenceMetadata
@@ -332,7 +354,7 @@
354 <_ResolvedProjectReferencePaths Remove="@(WixLibrary)" />
355 </ItemGroup>
356
335 - <!-- Convert resolved project references into compiler defines and named and unamed bind paths-->
357 + <!-- Convert resolved project references into compiler defines and named and unamed bind paths -->
358 <CreateProjectReferenceDefineConstantsAndBindPaths
359 ResolvedProjectReferences="@(_ResolvedProjectReferencePaths)"
360 ProjectConfigurations="$(VSProjectConfigurations)">