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

Address issues with VSIX item publishing projects and FUTDC #74470

Merged
merged 8 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion eng/targets/VisualStudio.targets
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,34 @@

<Import Project="GeneratePkgDef.targets" Condition="'$(MSBuildRuntimeType)' != 'Core' and '$(GeneratePkgDefFile)' == 'true' and '$(DesignTimeBuild)' != 'true' and '$(BuildingForLiveUnitTesting)' != 'true'" />

<!-- Workaround to fix https://github.com/dotnet/msbuild/issues/10306 -->
<!-- Workaround to fix https://github.com/dotnet/msbuild/issues/10306 -->
<Target Name="ExtensionJsonOutputGroupFixed" Returns="@(ExtensionJsonOutputGroupOutput)" DependsOnTargets="PrepareResources;ExtensionJsonOutputGroup" />

<!--
Workaround for missing dependency publishing feature in the VS SDK.

Relies on the following convention: When a project reference publish outputs (i.e. more than standard build outputs) need to be packaged into a VSIX,
the project should define PublishedProjectOutputGroup target and include it in ProjectRefrence.IncludeOutputGroupsInVSIX.

PublishedProjectOutputGroup target may gather all the publishing items to be packaged into the VSIX using PublishItemsOutputGroup target,
but should not depend on Publish target (i.e. invoking PublishedProjectOutputGroup target should not trigger actual publishing).

Target PublishProjectReferencesForVsixCreation will take care of publishing for all ProjectReferences with PublishedProjectOutputGroup.
-->

<PropertyGroup>
<CreateVsixContainerDependsOn>$(CreateVsixContainerDependsOn);PublishProjectReferencesForVsixCreation</CreateVsixContainerDependsOn>
</PropertyGroup>

<Target Name="PublishProjectReferencesForVsixCreation">
<ItemGroup>
<_ProjectsToPublish Include="@(ProjectReference)" Condition="$([MSBuild]::ValueOrDefault('%(ProjectReference.IncludeOutputGroupsInVSIX)', '').Contains('PublishedProjectOutputGroup'))"/>
</ItemGroup>

<MSBuild Projects="@(_ProjectsToPublish)"
BuildInParallel="$(BuildInParallel)"
Properties="%(_ProjectsToPublish.SetConfiguration);%(_ProjectsToPublish.SetPlatform);%(_ProjectsToPublish.SetTargetFramework)"
Targets="PublishVsixItems"
RebaseOutputs="true" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<Target Name="_DeploySemanticSearchRefAssemblies" AfterTargets="ResolveProjectReferences" Condition="'$(DesignTimeBuild)' != 'true'">

<MSBuild Projects="@(CopyPublishedOutputProjectReference)" Targets="PublishProjectOutputGroup" BuildInParallel="$(BuildInParallel)" Properties="%(CopyPublishedOutputProjectReference.SetTargetFramework)">
<MSBuild Projects="@(CopyPublishedOutputProjectReference)" Targets="PublishVsixItems" BuildInParallel="$(BuildInParallel)" Properties="%(CopyPublishedOutputProjectReference.SetTargetFramework)">
<Output TaskParameter="TargetOutputs" ItemName="%(CopyPublishedOutputProjectReference.OutputItemType)" />
</MSBuild>

Expand Down
30 changes: 21 additions & 9 deletions src/Interactive/HostProcess/x64/InteractiveHost64.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,43 @@
<Content Include="..\App.config" />
<Compile Include="..\InteractiveHostEntryPoint.cs" />
</ItemGroup>

<Target Name="PublishedProjectOutputGroup" DependsOnTargets="PublishItemsOutputGroup" Returns="@(_VsixItem)">
<!-- Workaround for https://github.com/dotnet/sdk/issues/42255 -->
<PropertyGroup>
<!-- IntermediateDepsFilePath is the location where the deps.json file is originally created -->
<_IntermediateDepsFilePath Condition=" '$(PublishDepsFilePath)' != ''">$(PublishDepsFilePath)</_IntermediateDepsFilePath >
<_IntermediateDepsFilePath Condition=" '$(PublishDepsFilePath)' == ''">$(IntermediateOutputPath)$(ProjectDepsFileName)</_IntermediateDepsFilePath >
</PropertyGroup>

<Target Name="PublishProjectOutputGroup" DependsOnTargets="Publish" Returns="@(_PublishedFiles)">
<ItemGroup>
<!-- Need to include and then update items (https://github.com/microsoft/msbuild/issues/1053) -->
<_PublishedFiles Include="$(PublishDir)**\*.*" />
<_PublishedFiles Remove="@(_PublishedFiles)" Condition="'%(Extension)' == '.pdb'" />
<_VsixItem Include="@(PublishItemsOutputGroupOutputs->'%(OutputPath)')" />
<_VsixItem Remove="@(_VsixItem)" Condition="'%(Extension)' == '.pdb'" />

<!-- Include .deps.json file (see https://github.com/dotnet/sdk/issues/42255) -->
<_VsixItem Include="$(_IntermediateDepsFilePath)" Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'" />

<!-- Include .rsp file -->
<_PublishedFiles Include="$(MSBuildProjectDirectory)\Desktop\CSharpInteractive.rsp" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
<_PublishedFiles Include="$(MSBuildProjectDirectory)\Core\CSharpInteractive.rsp" Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'" />
<_VsixItem Include="$(MSBuildProjectDirectory)\Desktop\CSharpInteractive.rsp" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
<_VsixItem Include="$(MSBuildProjectDirectory)\Core\CSharpInteractive.rsp" Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'" />

<!-- Include the specified .editorconfig file to pickup the correct interactive settings. -->
<_PublishedFiles Include="$(MSBuildProjectDirectory)\.editorconfig"/>
<_VsixItem Include="$(MSBuildProjectDirectory)\.editorconfig" />

<!-- Set TargetPath -->
<_PublishedFiles Update="@(_PublishedFiles)" TargetPath="%(RecursiveDir)%(Filename)%(Extension)" />
<_VsixItem Update="@(_VsixItem)" TargetPath="%(Filename)%(Extension)" Condition="'%(_VsixItem.TargetPath)' == ''" />

<!-- Set NGEN metadata -->
<_PublishedFiles Update="@(_PublishedFiles)" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and ('%(Extension)' == '.dll' or '%(Extension)' == '.exe')">
<_VsixItem Update="@(_VsixItem)" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and ('%(Extension)' == '.dll' or '%(Extension)' == '.exe')">
<Ngen>true</Ngen>
<NgenPriority>3</NgenPriority>
<NgenArchitecture Condition="'%(Filename)' != 'InteractiveHost64'">All</NgenArchitecture>
<NgenArchitecture Condition="'%(Filename)' == 'InteractiveHost64'">X64</NgenArchitecture>
<NgenApplication>[installDir]\Common7\IDE\$(CommonExtensionInstallationRoot)\$(LanguageServicesExtensionInstallationFolder)\InteractiveHost\Desktop\InteractiveHost64.exe</NgenApplication>
</_PublishedFiles>
</_VsixItem>
</ItemGroup>
</Target>

<Target Name="PublishVsixItems" DependsOnTargets="Publish;PublishedProjectOutputGroup" Returns="@(_VsixItem)" />
</Project>
21 changes: 12 additions & 9 deletions src/Interactive/HostProcess/x86/InteractiveHost32.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,25 @@

<!--
InteractiveHost32 is deployed to the same directory as InteractiveHost64 as it shares the same dependencies.

Ideally this would just return @(BuiltProjectOutputGroupOutput) but that does not reliably include the generated App.config file.
See https://github.com/microsoft/msbuild/issues/5433.

Use BuiltProjectOutputGroup as the dependend target to ensure the targets has all dependencies that BuiltProjectOutputGroupOutput would have.
-->
<Target Name="PublishProjectOutputGroup" DependsOnTargets="Build;BuiltProjectOutputGroup" Returns="@(_PublishProjectOutputGroup)">
<Target Name="PublishedProjectOutputGroup" Returns="@(_VsixItem)">
<ItemGroup>
<_PublishProjectOutputGroup Include="$(TargetPath)">
<_VsixItem Include="$(TargetPath)">
<TargetPath>$(TargetFileName)</TargetPath>
<Ngen>true</Ngen>
<NgenPriority>3</NgenPriority>
<NgenArchitecture>X86</NgenArchitecture>
<NgenApplication>[installDir]\Common7\IDE\$(CommonExtensionInstallationRoot)\$(LanguageServicesExtensionInstallationFolder)\InteractiveHost\Desktop\InteractiveHost32.exe</NgenApplication>
</_PublishProjectOutputGroup>
<_PublishProjectOutputGroup Include="$(TargetPath).config" TargetPath="$(TargetFileName).config"/>
</_VsixItem>
<_VsixItem Include="$(TargetPath).config" TargetPath="$(TargetFileName).config"/>
</ItemGroup>
</Target>

<!--
Ideally this would just return @(BuiltProjectOutputGroupOutput) but that does not reliably include the generated App.config file.
See https://github.com/microsoft/msbuild/issues/5433.

Use BuiltProjectOutputGroup as the dependend target to ensure the targets has all dependencies that BuiltProjectOutputGroupOutput would have.
-->
<Target Name="PublishVsixItems" DependsOnTargets="Build;BuiltProjectOutputGroup;PublishedProjectOutputGroup" Returns="@(_VsixItem)" />
</Project>
3 changes: 1 addition & 2 deletions src/Interactive/HostTest/InteractiveHost.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
-->
<Target Name="_DeployInteractiveHosts" AfterTargets="ResolveProjectReferences" Condition="'$(DesignTimeBuild)' != 'true'">

<MSBuild Projects="@(CopyPublishedOutputProjectReference)" Targets="PublishProjectOutputGroup" BuildInParallel="$(BuildInParallel)" Properties="%(CopyPublishedOutputProjectReference.SetTargetFramework)">

<MSBuild Projects="@(CopyPublishedOutputProjectReference)" Targets="PublishVsixItems" BuildInParallel="$(BuildInParallel)" Properties="%(CopyPublishedOutputProjectReference.SetTargetFramework)">
<Output TaskParameter="TargetOutputs" ItemName="%(CopyPublishedOutputProjectReference.OutputItemType)" />
</MSBuild>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@
</Target>

<!-- Used from Setup and test projects to fetch the list of generated ref assemblies -->
<Target Name="PublishProjectOutputGroup" Returns="@(_PublishProjectOutputGroupOutput)" DependsOnTargets="GenerateFilteredReferenceAssemblies">
<Target Name="PublishedProjectOutputGroup" DependsOnTargets="_CalculateFilteredReferenceAssembliesInputsAndOutputs" Returns="@(_OutputFile)" />

<ItemGroup>
<_PublishProjectOutputGroupOutput Include="@(_OutputFile)" />
</ItemGroup>
</Target>
<!-- Generates ref assemblies -->
<Target Name="PublishVsixItems" DependsOnTargets="PublishedProjectOutputGroup;GenerateFilteredReferenceAssemblies" Returns="@(_OutputFile)" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!-- This project targets netcoreapp -->
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>PublishProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIX>PublishedProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly></IncludeOutputGroupsInVSIXLocalOnly>
<Private>false</Private>
<!-- Disable NGEN. Core assemblies are crossgened. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!-- This project targets netcoreapp -->
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<IncludeOutputGroupsInVSIX>PublishProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIX>PublishedProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly></IncludeOutputGroupsInVSIXLocalOnly>
<Private>false</Private>
<!-- Disable NGEN. Core assemblies are crossgened. -->
Expand Down
8 changes: 4 additions & 4 deletions src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@

<Private>false</Private>
<VSIXSubPath>InteractiveHost\Core</VSIXSubPath>
<IncludeOutputGroupsInVSIX>PublishProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIX>PublishedProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly></IncludeOutputGroupsInVSIXLocalOnly>

<!-- Disable NGEN. Core assemblies are crossgened. -->
Expand All @@ -293,7 +293,7 @@

<Private>false</Private>
<VSIXSubPath>InteractiveHost\Desktop</VSIXSubPath>
<IncludeOutputGroupsInVSIX>PublishProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIX>PublishedProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly></IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
<ProjectReference Include="..\..\Interactive\HostProcess\x86\InteractiveHost32.csproj">
Expand All @@ -308,7 +308,7 @@

<Private>false</Private>
<VSIXSubPath>InteractiveHost\Desktop</VSIXSubPath>
<IncludeOutputGroupsInVSIX>PublishProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIX>PublishedProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly></IncludeOutputGroupsInVSIXLocalOnly>
</ProjectReference>
<ProjectReference Include="..\..\Tools\SemanticSearch\ReferenceAssemblies\SemanticSearch.ReferenceAssemblies.csproj">
Expand All @@ -317,7 +317,7 @@
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>false</Private>
<VSIXSubPath>SemanticSearchRefs</VSIXSubPath>
<IncludeOutputGroupsInVSIX>PublishProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIX>PublishedProjectOutputGroup</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly></IncludeOutputGroupsInVSIXLocalOnly>
<Ngen>false</Ngen>
</ProjectReference>
Expand Down
Loading
Loading