Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicDependentFile capability broken in VS 15.5 #261

Closed
aienabled opened this issue Jan 17, 2018 · 7 comments
Closed

DynamicDependentFile capability broken in VS 15.5 #261

aienabled opened this issue Jan 17, 2018 · 7 comments

Comments

@aienabled
Copy link

aienabled commented Jan 17, 2018

I've noticed that the feature described in this document https://github.com/Microsoft/VSProjectSystem/blob/94d62cdad747ae1e035cfc2f39752962d5637c4b/doc/extensibility/automatic_DependentUpon_wireup.md is broken in VS 15.5.

Reported the issue there dotnet/project-system#3155

@aienabled
Copy link
Author

@adrianvmsft

@jviau
Copy link
Member

jviau commented Jan 26, 2018

The xaml content type CPS is receiving from .netcore for .xaml files is missing the necessary metadata for this to work.

I updated the issue in dotnet/project-system pointing to the incorrect file.

@jviau jviau closed this as completed Jan 26, 2018
@aienabled
Copy link
Author

Please re-read my first post. I'm pointing on a particular CPS feature which is broken to me since VS 15.5 update.
Responded there in more details dotnet/project-system#3155 (comment)

@jviau
Copy link
Member

jviau commented Jan 26, 2018

Is your project system based off of the .netcore system or do you import Microsoft.Common.props or targets? If so, it is possible that your project system is using their .xaml content type now and not yours.

I say this, because when I add the appropriate metadata to the file I mentioned in the other issue, it properly nests.

@aienabled
Copy link
Author

aienabled commented Jan 26, 2018

@jviau, thank you!
My project system is using Microsoft.NET.Sdk (you refer to it as the .netcore system if I understand correctly).
I didn't try the dynamic dependent file wireup on other file types and made the wrong assumption that the DynamicDependentFile capability broken with the last VS update.

I've tried removing my .XAML content type definition now (completely with my ProjectItemsSchema.xaml) and it works without it so it should be using the content type definition from the .netcore project system. However, I've noticed that I still need to include my custom Page.xaml rule in the CustomProject.targets:

<PropertyPageSchema Include="$(MSBuildThisFileDirectory)Rules\Page.xaml">
	<Context>File;BrowseObject</Context>
</PropertyPageSchema>		

otherwise the XAML files are not visible in the project using my custom project system. I'm confused, isn't it should be using this XAML rule https://github.com/dotnet/project-system/blob/master/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/Rules/Page.xaml (and ProjectItemsSchema.xaml nearby) and my XAML rule should not be required? (UPD: it seems I've found the answer - the only place explicitly including Page.xaml is Microsoft.Managed.DesignTime.targets which is even more confusing!)

Another curiosity is why the issue revealed only now when the .netcore project system added support for XAML Page about half a year ago https://github.com/dotnet/project-system/blob/master/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/Rules/ProjectItemsSchema.xaml

Is there any way to override the content type definition? I would prefer to use my custom definition from my ProjectItemsSchema.xaml at least until it's properly implemented in the .netcore project system.

@jviau
Copy link
Member

jviau commented Jan 26, 2018

For overriding their content type you can try playing the order they are appear in MSBuild evaluation. I can't remember off the top of my head if we default to the first or last appearance of a content type, so try both ways. Have yours appear before theirs, then after. If that doesn't work the only other way I can think of is to copy their file, edit it, add an msbuild item to remove their file from evaluation, and include yours.

@jviau
Copy link
Member

jviau commented Jan 26, 2018

As for why it just started breaking, it depends on if you had UWP installed. The rule from the SDK was broken and not shipping for a while by accident, but it was missed because UWP workload also brings in a xaml rules for the .xaml "Page" item type, so that was masking the mistake for a while.

aienabled added a commit to aienabled/WpfNewProjectSystemSample that referenced this issue Jan 27, 2018
Now framework version specified right in the each csproj file.

Microsoft.NET.Sdk including now done in the CustomProject.props
(previously it was in the each csproj file).

Added workaround for issue
microsoft/VSProjectSystem#261

Dropped ReSharper workaround as it's not needed anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants