Closed ravipal closed 7 years ago
What am I missing, this looks like: https://github.com/NuGet/Home/issues/4253?
Are you saying that EnvDTE80.Solution2.AddFromTemplate returns null?
The error message is similar to NuGet/Home#4253 but it is a different issue. Yes EnvDTE80.Solution2.AddFromTemplate returns null.
@ravipal is this blocking you for RTM? Let me know if I need to pull this back in to RTM.
We have a workaround, so it is not blocking the RTM. But ideally, we would like to not have workaround, so if it feasible, please fix this in RTM.
FYI EnvDTE80.Solution2.AddFromTemplate is supposed to return null for VB and C# projects. See the remarks in https://msdn.microsoft.com/en-us/library/behck2xd.aspx. Searching dte.Solution.Projects by project name is the documented solution.
Yeah good spot. Looking through the code it only returns a project when it's not a vstemplate/vsz.
Based on that and that the original NuGet issue is resolved, I'll close this.
The issue was, after the call to AddFromTemplate(), the project is still not in loaded state as a result when we use nuget package installer, it fails because the project is not ready.
Which is different from https://github.com/NuGet/Home/issues/4253 how?
As part of service fabric application creation, we create a ASP .Net Core project from template using below call. EnvDTE80.Solution2.AddFromTemplate(); This supposed to return the Project instance with the project tree loaded. But it returns null. Then we use dte.Solution.Projects to search by project name to get the project.
Later when we install NugetPackage (IVsPackageInstaller.InstallPackage) to the above project the installation fails with below exception. As per Nuget team, the failures is caused because the project is still not loaded
The operation failed as details for project Web1 could not be loaded.System.InvalidOperationException: The operation failed as details for project Web1 could not be loaded. at NuGet.PackageManagement.VisualStudio.CpsPackageReferenceProject.GetAssetsFilePathAsync() at NuGet.PackageManagement.NuGetPackageManager.d74.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at NuGet.PackageManagement.NuGetPackageManager.d 65.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.PackageManagement.NuGetPackageManager.d48.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.PackageManagement.NuGetPackageManager.d 47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.VisualStudio.VsPackageInstaller.d26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NuGet.VisualStudio.VsPackageInstaller.d 25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NuGet.VisualStudio.VsPackageInstaller.d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
at NuGet.VisualStudio.VsPackageInstaller.InstallPackage(String source, Project project, String packageId, String version, Boolean ignoreDependencies)
at Microsoft.VisualStudio.Azure.Fabric.Shared.ServiceCreation.ServiceTemplateInterpreter.InstallNuGetPackages(IServiceProvider serviceProvider, Hierarchy project, ServiceTemplateServiceContentProjectPackage[] packages, String serviceId)Failed to install package 'Microsoft.ServiceFabric.Data':
Steps to repro: