Automatically generate binding redirects assembly attributes for the Razor VSIX

This commit is contained in:
Nate McMaster 2018-06-27 16:38:21 -07:00
parent c7fafa1e63
commit ca2d5738d6
No known key found for this signature in database
GPG Key ID: A778D9601BD78810
2 changed files with 27 additions and 72 deletions

View File

@ -76,7 +76,6 @@
<Compile Include="RazorInfo\AssemblyViewModel.cs" />
<Compile Include="Behaviors\ItemSelectedBehavior.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\BindingRedirectAttributes.cs" />
<Compile Include="RazorInfo\DirectiveViewModel.cs" />
<Compile Include="RazorInfo\DocumentInfoViewModel.cs" />
<Compile Include="RazorInfo\DocumentViewModel.cs" />
@ -320,6 +319,7 @@
<PropertyGroup>
<_GeneratedVSIXAssemblyInfoInputsCacheFile>$(IntermediateOutputPath)$(MSBuildProjectName).VSIXAssemblyInfo.cache.txt</_GeneratedVSIXAssemblyInfoInputsCacheFile>
<_GeneratedVSIXAssemblyInfoFile>$(IntermediateOutputPath)$(MSBuildProjectName).VSIXAssemblyInfo.cs</_GeneratedVSIXAssemblyInfoFile>
<_GeneratedVSIXBindingRedirectFile>$(IntermediateOutputPath)$(MSBuildProjectName).BindingRedirects.cs</_GeneratedVSIXBindingRedirectFile>
</PropertyGroup>
<!--
We need to generate the assembly attributes for our assembly using the version from the build, so
@ -330,6 +330,29 @@
<_Parameter1>$(VsixVersion)</_Parameter1>
</_VSIXAssemblyAttribute>
</ItemGroup>
<Target Name="_GenerateVSIXBindingRedirects"
DependsOnTargets="PrepareForBuild"
BeforeTargets="CoreCompile"
Inputs="$(MSBuildAllProjects)"
Outputs="$(_GeneratedVSIXBindingRedirectFile)">
<PropertyGroup>
<_GeneratedVSIXBindingRedirectContent>
<![CDATA[
// <auto-generated />
using Microsoft.VisualStudio.Shell;
@(ProjectReference->'[assembly: ProvideBindingRedirection(AssemblyName = "%(Name)", GenerateCodeBase = true, PublicKeyToken = "adb9793829ddae60", OldVersionLowerBound = "0.0.0.0", OldVersionUpperBound = "$(VersionPrefix).0", NewVersion = "$(VersionPrefix).0")]', '%0A')
]]>
</_GeneratedVSIXBindingRedirectContent>
</PropertyGroup>
<WriteLinesToFile Lines="$([MSBuild]::Escape($(_GeneratedVSIXBindingRedirectContent)))" File="$(_GeneratedVSIXBindingRedirectFile)" Overwrite="True" WriteOnlyWhenDifferent="True" />
<ItemGroup>
<Compile Include="$(_GeneratedVSIXBindingRedirectFile)">
<Visible>false</Visible>
</Compile>
<FileWrites Include="$(_GeneratedVSIXBindingRedirectFile)" />
</ItemGroup>
</Target>
<Target Name="_GenerateVSIXAssemblyAttributesHash" DependsOnTargets="PrepareForBuild" Condition="'@(_VSIXAssemblyAttribute)' != ''">
<!-- We only use up to _Parameter1 for most attributes, but other targets may add additional assembly attributes with multiple parameters. -->
<Hash ItemsToHash="@(_VSIXAssemblyAttribute->'%(Identity)%(_Parameter1)%(_Parameter2)%(_Parameter3)%(_Parameter4)%(_Parameter5)%(_Parameter6)%(_Parameter7)%(_Parameter8)')">

View File

@ -1,68 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.VisualStudio.Shell;
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.AspNetCore.Mvc.Razor.Extensions",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "2.1.1.0",
NewVersion = "2.1.1.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "2.1.1.0",
NewVersion = "2.1.1.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.AspNetCore.Razor.Language",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "2.1.1.0",
NewVersion = "2.1.1.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.CodeAnalysis.Razor",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "2.1.1.0",
NewVersion = "2.1.1.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.CodeAnalysis.Razor.Workspaces",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "2.1.1.0",
NewVersion = "2.1.1.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.CodeAnalysis.Remote.Razor",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "2.1.1.0",
NewVersion = "2.1.1.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.Editor.Razor",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "2.1.1.0",
NewVersion = "2.1.1.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.LanguageServices.Razor",
GenerateCodeBase = true,
PublicKeyToken = "adb9793829ddae60",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "2.1.1.0",
NewVersion = "2.1.1.0")]