Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit ae41a03

Browse files
committed
Fix intellisense breaks
We were previously ILRepack'ing to the intermediate assembly unconditionally. This means that we'd ILRepack an already ILRepack'ed assembly, and that failed and caused intellisense to not work at all. So instead, we write a flag file that tells us we have already ilrepack'ed, and use that as the outputs of the targets. We don't add it as a FileWrites since otherwise incremental clean would interfere. Also, there was a duplicate reference to the ThisAssembly.Project nuget package that is already imported in the shared targets, and it was also interferring with intellisense.
1 parent a1a4424 commit ae41a03

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Tasks.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<PackageReference Include="netfx-System.StringResources" Version="3.1.5" PrivateAssets="all" />
1212
<PackageReference Include="Microsoft.Build" Version="14.3.0" PrivateAssets="all" />
1313
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3.0" PrivateAssets="all" />
14-
<PackageReference Include="MSBuilder.ThisAssembly.Project" Version="0.3.3" PrivateAssets="all" />
1514
<PackageReference Include="Newtonsoft.Json" Version="6.0.8" PrivateAssets="all" />
1615
<PackageReference Include="NuGet.Client" Version="4.0.0" PrivateAssets="all" />
1716
<PackageReference Include="NuGet.Packaging" Version="4.0.0" PrivateAssets="all" />

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Tasks.targets

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ namespace $(RootNamespace)
9494
<Target Name="ILRepack"
9595
AfterTargets="CoreCompile"
9696
DependsOnTargets="CoreCompile"
97+
Inputs="@(IntermediateAssembly->'%(FullPath)')"
98+
Outputs="$(IntermediateOutputPath)ilrepack.txt"
9799
Returns="@(MergedAssemblies)"
98-
Condition="'$(ILRepack)' != 'false'">
100+
Condition="Exists(@(IntermediateAssembly->'%(FullPath)')) and '$(ILRepack)' != 'false'">
99101
<GetReferenceAssemblyPaths BypassFrameworkInstallChecks="False" TargetFrameworkMoniker="$(TargetFrameworkMoniker)">
100102
<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FullFrameworkReferenceAssemblyPaths" />
101103
</GetReferenceAssemblyPaths>
@@ -109,6 +111,7 @@ namespace $(RootNamespace)
109111
<PropertyGroup>
110112
<ILRepackArgs Condition="'$(AssemblyOriginatorKeyFile)' != ''">/keyfile:&quot;$(AssemblyOriginatorKeyFile)&quot;</ILRepackArgs>
111113
</PropertyGroup>
114+
<Touch AlwaysCreate="true" Files="$(IntermediateOutputPath)ilrepack.txt" />
112115
<Exec Command="&quot;$(ILRepack)&quot; @(LibDir->'/lib:&quot;%(Identity).&quot;', ' ') $(ILRepackArgs) /targetplatform:&quot;v4,$(FullFrameworkReferenceAssemblyPaths.TrimEnd(\\))&quot; /out:&quot;@(IntermediateAssembly->'%(FullPath)')&quot; &quot;@(IntermediateAssembly->'%(FullPath)')&quot; @(MergedAssemblies->'&quot;%(FullPath)&quot;', ' ')"
113116
WorkingDirectory="$(MSBuildProjectDirectory)\$(OutputPath)"
114117
StandardErrorImportance="high"
@@ -119,6 +122,7 @@ namespace $(RootNamespace)
119122
<Output TaskParameter="ExitCode" PropertyName="ExitCode"/>
120123
</Exec>
121124
<Message Importance="high" Text="$(ILRepackOutput)" Condition="'$(ExitCode)' != '0'" />
125+
<Delete Files="$(IntermediateOutputPath)ilrepack.txt" Condition="'$(ExitCode)' != '0'" />
122126
<Error Text="$(ILRepackOutput)" Condition="'$(ExitCode)' != '0' And '$(ContinueOnError)' != 'true'" />
123127
<Delete Files="@(MergedAssemblies -> '$(MSBuildProjectDirectory)\$(OutputPath)%(Filename)%(Extension)')" Condition="Exists('$(MSBuildProjectDirectory)\$(OutputPath)%(Filename)%(Extension)')" />
124128
</Target>

0 commit comments

Comments
 (0)