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

Commit 4e35cf9

Browse files
authored
Fix assembly embedding and initialization (#112)
Even though the Fody.Costura team members argue otherwise, the embedding and module initialization works just fine for libraries. So instead of relying on our own fork of it, or switch to more involed ILRepack approach, we simply add an entry point to the tasks assembly to make the tool happy. See https://github.com/Fody/Costura/blob/52630a7341e1a8193c0c208a1b9dd98d2096699c/src/Costura/ModuleWeaver.cs#L25
1 parent b29165e commit 4e35cf9

5 files changed

Lines changed: 18 additions & 6 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<PropertyGroup>
66
<ProjectGuid>{A3D231D7-31E4-4A70-8CD1-7246C7D069F6}</ProjectGuid>
77
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
8+
<OutputType>Exe</OutputType>
9+
<TargetExt>.dll</TargetExt>
10+
<StartupObject>NuGet.Build.Packaging.Program</StartupObject>
811
</PropertyGroup>
912
<ItemGroup>
1013
<Reference Include="System" />
@@ -58,13 +61,17 @@
5861
</EmbeddedResource>
5962
</ItemGroup>
6063
<ItemGroup>
64+
<Compile Include="..\..\GlobalAssemblyInfo.cs">
65+
<Link>GlobalAssemblyInfo.cs</Link>
66+
</Compile>
6167
<Compile Include="ApiIntersect.cs" />
6268
<Compile Include="AssignPackagePath.cs" />
6369
<Compile Include="CreatePackage.cs" />
6470
<Compile Include="Extensions.cs" />
6571
<Compile Include="GenerateAssemblyInfo.cs" />
6672
<Compile Include="GetApiIntersectTargetPaths.cs" />
6773
<Compile Include="MetadataName.cs" />
74+
<Compile Include="Program.cs" />
6875
<Compile Include="Properties\Resources.Designer.cs">
6976
<AutoGen>True</AutoGen>
7077
<DesignTime>True</DesignTime>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
3+
namespace NuGet.Build.Packaging
4+
{
5+
class Program
6+
{
7+
[STAThread]
8+
public static void Main(string[] args) { }
9+
}
10+
}

src/GlobalAssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[assembly: AssemblyCopyright ("Copyright © 2016")]
99
[assembly: AssemblyTrademark("")]
1010
[assembly: AssemblyCulture("")]
11-
[assembly: AssemblyTitle(ThisAssembly.AssemblyName)]
11+
[assembly: AssemblyTitle(ThisAssembly.Project.AssemblyName)]
1212

1313

1414
#if DEBUG

src/NuGet.Build.Packaging.Shared.targets

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ namespace $(ThisAssemblyNamespace)
3333

3434
<Import Project="$(MSBuildProjectDirectory)\$(MSBuildProjectName).targets" Condition="Exists('$(MSBuildProjectDirectory)\$(MSBuildProjectName).targets')" />
3535

36-
<ItemGroup Condition=" '$(NoGlobalAssemblyInfo)' != 'true' And '$(Language)' == 'C#' ">
37-
<Compile Include="$(MSBuildThisFileDirectory)GlobalAssemblyInfo.cs" Condition="'$(BuildingProject)' == 'true'" />
38-
</ItemGroup>
39-
4036
<PropertyGroup>
4137
<NuGetPackagingTargetsImported>true</NuGetPackagingTargetsImported>
4238
</PropertyGroup>

src/VisualStudio/NuGet.Packaging.VisualStudio.Shared.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<StartProgram Condition="'$(VisualStudioVersion)' &lt; '15.0'">$(MSBuildProgramFiles32)\Microsoft Visual Studio $(VisualStudioVersion)\Common7\IDE\devenv.exe</StartProgram>
1616
<StartProgram Condition="'$(VisualStudioVersion)' &gt;= '15.0'">$(VsInstallRoot)\Common7\IDE\devenv.exe</StartProgram>
1717
<StartArguments>/rootsuffix exp</StartArguments>
18-
<NoGlobalAssemblyInfo>true</NoGlobalAssemblyInfo>
1918
<XmlNs>&lt;Namespace Prefix='vs' Uri='http://schemas.microsoft.com/developer/vstemplate/2005'/&gt;</XmlNs>
2019
</PropertyGroup>
2120

0 commit comments

Comments
 (0)