I have a C++ console application in Visual Studio under Git, in which I have a submodule static library called LibrarySubmoduleSolution
. This LibrarySubmoduleSolution
uses Windows Implementation Library NuGet package.
After I download Git submodule in my VCPPConsoleApplicationSolution
main solution and restore NuGet packages in the solution, I get these errors:
Severity Code Description Project File Line
Suppression State Error This project references NuGetpackage(s) that are missing on this computer. Use NuGet PackageRestore to download them. For more information, seehttp://go.microsoft.com/fwlink/?LinkID=322105. The missing file is..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets. LibrarySubmoduleSolution
D:\Projects\Tests\VCPPConsoleApplicationSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution.vcxproj166 Severity Code Description Project File Line
Suppression State Error C1083 Cannot open include file:'wil/resource.h': No such file or directory
VCPPConsoleApplicationSolution
D:\Projects\Tests\VCPPConsoleApplicationSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution\SomeClass.h3
I searched for answers on Google and here on Stackoverflow and even after I edit my LibrarySubmoduleSolution.vcxproj
file and change packages folder from ..\packages
to $(SolutionDir)\packages
:
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /><ImportGroup Label="ExtensionTargets"><Import Project="$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" /></ImportGroup><Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"><PropertyGroup><ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText></PropertyGroup><Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.ImplementationLibrary.1.0.200519.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" /></Target>
I still can't build with the error:
Severity Code Description Project File Line Suppression StateError C1083 Cannot open include file: 'wil/resource.h': No such fileordirectory VCPPConsoleApplicationSolution D:\Projects\Tests\VCPPConsoleApplicationSolution\LibrarySubmoduleSolution\LibrarySubmoduleSolution\SomeClass.h 3
Only after I install Windows Implementation Library NuGet package in my main console application project, it starts to build without errors.
Here is main and submodule solutions to quickly reproduce errors:https://github.com/KulaGGin/VCPPConsoleApplicationSolutionhttps://github.com/KulaGGin/LibrarySubmoduleSolution