Recently I was involved to evaluate one new O365
function and there is one client Visual Project passed to me. I really want to compile this project so I can debug through the code but there are two
major issues.
1. When we compile this solution, it give the following
error message.
This project references NuGet package(s) that are missing on
this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.
2. When we try to Manage Nuget package, we got the following
error.
"Operation failed. Unable to locate solution directory.
Please ensure that the solution has been saved."
After researching the issue, we found this project was NuGet Package Manager enabled
solutions and we would better to migrate to NuGet Automatic Package Restore as
recommended. Here is the complete procedure to rebuild the project.
1. Remove following NuGet dependencies from the project file named yourprojectname.csproj as described here. Save the project file and then you could reopen it from Visual Studio. This will resolve issue #1.
<RestorePackages>true</RestorePackages>
...
<Import
Project="$(SolutionDir)\.nuget\nuget.targets" />
...
<Target
Name="EnsureNuGetPackageBuildImports"
BeforeTargets="PrepareForBuild"> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on
this computer. Enable 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)\.nuget\NuGet.targets')"
Text="$([System.String]::Format('$(ErrorText)',
'$(SolutionDir)\.nuget\NuGet.targets'))" /> </Target>
2. Click save the project. This will resolve issue #2.
3. Right click solution and click Enable NuGet Automatic Package Restore. This will migrate to use Automatic Package Restore to avoid future NuGet package issue.
4. Right click References for the project and click Manage Nuget package. Search package required for the project such as "Active Directory Application Library". Install the package.
Now you will a project that can be compiled for debugging.
No comments:
Post a Comment