Support for projects created with Microsoft Common Project System

Completed

Hello!
I've created a custom project system based on Microsoft CPS https://github.com/Microsoft/VSProjectSystem
I'm need to turn on ReSharper support for it. I know that ".xproj" projects (ASP.NET 5) also built on top of CPS and ReSharper supports it, and the "Shader project" type also use CPS. So maybe is not too hard to add support for any other CPS-based systems.
BTW, CPS could be enabled for any regular C# project by changing project type GUID as the solution file as described here https://github.com/Microsoft/VSProjectSystem/blob/02191b00b6da83a152c118e653573068c5166869/doc/scenario/turn_on_cps_for_csharp_vb_project.md .
Regards!

10 comments
Comment actions Permalink

Nevermind, guys.

I've found why ReSharper doesn't work properly for my custom project. By default, there is a property

<TargetFrameworkMoniker>.NETFramework,Version=$(TargetFrameworkVersion)</TargetFrameworkMoniker>
at
CustomProject.Default.Props
. There is also
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
right above it. I've fixed it by assigning specific version for $TargetFrameworkMoniker:
<TargetFrameworkMoniker>.NETFramework,Version=4.6.1</TargetFrameworkMoniker>
.

Also it was required to import CSharp targets directly at the project file, even if you importing them at your targets file. Just add this line
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />


Now ReSharper works fine.

Regards!
0
Comment actions Permalink

Unfortunately there are still some problems.
The menu item "Resharper->Tools->Cleanup code" is inactive. I cannot use code cleanup shortcut because "command (...) is not currently available".
How could I investigate why it's not available and add support for this?
Regards!

0
Comment actions Permalink

Thanks, but I don't have any ReSharper extensions installed (fresh system). So it doesn't resolve the issue.
The cleanup works fine for regular C# Projects and DNX projects, but doesn't work for custom project created with Microsoft Common Project System (BTW, in my case it uses csproj extension). Refactoring and any other features I tried works properly.

0
Comment actions Permalink

I've enabled ReSharper logging and found this exception after project reload:

--- EXCEPTION #1/2 [NotImplementedException]
Message = “The method or operation is not implemented.”
ExceptionPath = Root.InnerException
ClassName = System.NotImplementedException
HResult = E_NOTIMPL=80004001
Source = Microsoft.VisualStudio.ProjectSystem.VS.Implementation
StackTraceString = “
  at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAVSProjectEvents.get_ImportsEvents()
     at JetBrains.VsIntegration.ProjectDocuments.VSProjectInfo.BindImportsChangedEvents()


--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “The method or operation is not implemented.”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.VsIntegration.ProjectDocuments.Projects.Builder.ProjectModelSynchronizer.BindToVsHierarchyAndFillProjectContent(IVsHierarchy hierarchy, IProject project, Boolean needPopulateReferences)
     at JetBrains.VsIntegration.ProjectDocuments.Projects.Builder.ProjectModelSynchronizer.CreateProject(IVsHierarchy hierarchy, IProjectDescriptor descriptor, UpdateFlags updateFlags, Boolean needPopulateReferences)
     at JetBrains.VsIntegration.ProjectDocuments.Projects.Builder.ProjectModelSynchronizer.OnAddHierarchy(IVsHierarchy hierarchy, Boolean updateProjectReferences, Int32 nAttempt)
     at JetBrains.VsIntegration.ProjectDocuments.VSSolutionManager.<>c__DisplayClass1c.<OnAfterOpenProject>b__1b()
     at JetBrains.Util.Concurrency.UnguardedCallbackMerger.<>c__DisplayClass3.<ExecuteOrQueueOrMerge>b__0()
     at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)
     at JetBrains.Threading.ReentrancyGuard.TryExecute(String name, Action action)
     at JetBrains.Threading.ReentrancyGuardEx.ExecuteOrQueue(ReentrancyGuard thіs, Lifetime lifetime, String name, Action F, TaskPriority priority)
     at JetBrains.Util.Concurrency.UnguardedCallbackMerger.ExecuteOrQueueOrMerge(Lifetime lifetimeQueue, String name, Action F)
     at JetBrains.VsIntegration.ProjectDocuments.VSSolutionManager.OnAfterOpenProject(IVsHierarchy pHierarchy, Int32 fAdded)
     at JetBrains.Platform.VisualStudio.SinceVs10.ProjectDocuments.VsSolutionManager10.OnAfterOpenProject(IVsHierarchy pHierarchy, Int32 fAdded)


Could it be related to "code cleanup" missing issue?
Do I need to report this to the bug tracker?

0
Comment actions Permalink

Hello Vladimir

  Yes, such exception might be related to missing Cleanup Code.

  Please file an issue to YouTrack with a sample demo solution attached  https://youtrack.jetbrains.com/issues/RSRP.

Thanks!  

0
Comment actions Permalink

Thank you. I will do this right now.
UPD. Reported - https://youtrack.jetbrains.com/issue/RSRP-452621

0
Comment actions Permalink

Awesome! Thanks!

I assigned it to the right person.

0
Comment actions Permalink

Thank you very much! The issue is resolved at 10.1 EAP1.

By the way, there are still a lot of warning messages "Method 'Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAVSReference.EmbedInteropTypes' not found." at the log.

I found one more issue related to this. I reported it there https://youtrack.jetbrains.com/issue/RSRP-453644 with a demo-project. Unfortunately, I still didn't receive any feedback regarding this issue. Now there is EAP3 and the issue still present, I'm afraid it will go into the 10.1 release.

Regards!

0
Comment actions Permalink

The issue is marked as fixed now. I will confirm it as soon as you release the next EAP.

Thank you guys! I appreciate your awesome work.

BTW, I've a new issue since EAP2 with C# shared projects (bogus errors). I will report it ASAP.

0

Please sign in to leave a comment.