I have a UWP project that was created using Visual Studio 2017. It builds fine on this machine (machine 1).
However, when I copy the project over to a machine (machine 2) where I only have the Visual Studio 2017 Build Tools installed, and attempt to build it using MSBuild, I get the following error:
C:Program Files (x86)Microsoft Visual Studio2017BuildToolsMSBuild15.0BinMicrosoft.Common.CurrentVersion.targets
(1126,5): error MSB3644: The reference assemblies for framework ".NETCore,Version=v5.0" were not found. To resolve this
, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framewo
rk for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assemb
ly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted
for the framework you intend. [<path_to_my_UWP_project>UWP.csproj]
I suspect the need for .NetCore v5.0 arises from this line in my UWP.csproj file:
< PackageReference
Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.0.1"
/>
I do a nuget restore before I build on machine 2, and I can see that microsoft.netcore.universalwindowsplatform successfully gets restored under < C_Users_me >/.nuget/packages, and so does microsoft.netcore.
On machine 1 however, only microsoft.netcore.universalwindowsplatform gets restored but it still builds fine via Visual Studio.
Question: Why am I getting this error and how do I fix the problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…