Skip to content

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Mar 16, 2018

The most important thing is <EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems> in VisualFSharp.UnitTests.fsproj. The other changes use more normal ways to specify the resources, and ensure we restore test projects with build vs

With this was able to

  • msbuild VisualFSharp.sln
  • build VisualFSharp.sln from VS
  • F5 launch into VisualFSharpFull.vsix.

However this doesn't solve the endless rebuild of FSHarp.Editor, which really kills the usability of VisualFSharp.sln when hitting F5

@brettfo please take a look.


<ItemGroup>
<EmbeddedResource Update="FSharp.Editor.resx">
<EmbeddedResource Include="FSharp.Editor.resx">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brettfo I'm pretty sure this is normal, I think you were only using Update to avoid EnableDefaultEmbeddedResourceItems?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I was using Update because $(EnableDefault...) was true. What's the benefit to specifying it this way, e.g., to not allowing the **/*.resx glob from running? The default behavior for SDK projects is to auto-include all *.resx files into the @(EmbeddedResource) item collection. I was trying to stay in line with that so that if another *.resx file is added to this directory that it's automatically included in the group so we don't have to manually manage the files in the project.

<Import Project="..\src\root.traversal.targets"/>

<Target Name="Restore">
<MSBuild Projects="@(ProjectFiles)" Targets="Restore" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're going to restore everything then remove all of the <SdkProjects> lines; those only existed to restore a subset of the projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed we don't need this


<ItemGroup>
<EmbeddedResource Update="FSharp.Editor.resx">
<EmbeddedResource Include="FSharp.Editor.resx">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I was using Update because $(EnableDefault...) was true. What's the benefit to specifying it this way, e.g., to not allowing the **/*.resx glob from running? The default behavior for SDK projects is to auto-include all *.resx files into the @(EmbeddedResource) item collection. I was trying to stay in line with that so that if another *.resx file is added to this directory that it's automatically included in the group so we don't have to manually manage the files in the project.


<ItemGroup>
<EmbeddedResource Update="Microsoft.VisualStudio.Package.LanguageService.resx">
<EmbeddedResource Include="Microsoft.VisualStudio.Package.LanguageService.resx">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same Update vs. Include comment as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned below, the default globbing was incorrectly picking up resources from a project in MockTypeProviders subfolder after you built those projects

<ItemGroup>
<!-- VSPackage.resx already included -->
<EmbeddedResource Update="FSLangSvcStrings.resx">
<EmbeddedResource Include="FSLangSvcStrings.resx">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

<NoWarn>$(NoWarn);45;47;52;58;75</NoWarn>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UsePackageTargetFallbackHack>true</UsePackageTargetFallbackHack>
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit, particularly with this project and VisualFSharp.UnitTests where there are no *.resx files? If the **/*.resx glob is breaking incremental build then that's a larger issue we should address at the SDK level.

Copy link
Contributor Author

@dsyme dsyme Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brettfo It wasn't the incremental build (that is still broken) - it was that VisualFSharp.UnitTests project has non-SDK projects in the MockTypeProviders sub-directories which put resources in obj/Debug directories when built, and the implicit glob was incorrectly picking those up, but only after a build

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about the obj\Debug issue. I see that you rearranged the directories which I like. Only one final nit-pick; instead of decorating each project with <EnableDefault...>false</> can you add it to an appropriate upstream Directory.Build.props or FSharp.Directory.Build.props? That way we won't forget to add it to any new projects in those subdirectories.

@KevinRansom
Copy link
Contributor

@brettfo I had the same question, but came down on the side of meh ... at least this way it is explicit.

@dsyme
Copy link
Contributor Author

dsyme commented Mar 16, 2018

Re Update or Include and implict v. explicit. I think I don't mind either way. I couldn't find any MSBuild documentation for Update= and had no good mental model for how it worked in combination with globbing (while avoiding duplicates) so assumed we were using some internal thing. And I needed to use EnableDefaultEmbeddedResourceItems in one project because the implicit resource glob was incorrect for "VisualFSharp.UnitTests" (incorrectly getting a completely unrelated resource from nested project MockTypeProviders), so I basically no longer trusted implicit globbing, since it had lost me quite a few hours already.

Are we actually relying on the implicit glob anywhere?

@dsyme
Copy link
Contributor Author

dsyme commented Mar 16, 2018

@brettfo @KevinRansom I've also permanently removed the use of nested projects:

  • vsintegration/tests/unittests/MockTypeProviders --> vsintegration/tests/MockTypeProviders
  • vsintegration/tests/unittests --> vsintegration/tests/UnitTests so it no longer looks like a directory name you might nest further projects in.

Those renames/moves are enough to solve the problem

image

@dsyme
Copy link
Contributor Author

dsyme commented Mar 19, 2018

@brettfo I'll merge this if that's ok - I've mentioned above why moving to implicit globbing was a problem for us

@dsyme dsyme merged commit 4df9975 into dotnet:master Mar 19, 2018
@dsyme
Copy link
Contributor Author

dsyme commented Mar 19, 2018

@brettfo Sorry, I didn't see this comment for some reason:

Only one final nit-pick; instead of decorating each project with <EnableDefault...>false</> can you add it to an appropriate upstream Directory.Build.props or FSharp.Directory.Build.props? That way we won't forget to add it to any new projects in those subdirectories.

Agreed we should do that

nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Jan 26, 2022
* fixes for VisualFSharp.sln usage

* fixes for VisualFSharp.sln usage

* Update FSharpEmbedResourceText.fs

* move MockTypeProviders

* rename vsintegration/tests/unittests --> vsintegration/VisualFSharp.UnitTests

* rename again

* fix paths
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

Successfully merging this pull request may close these issues.

3 participants