fody

No weaver found when trying to package my weaver


I've followed the instructions here https://github.com/Fody/Home/blob/master/pages/addin-development.md but when I build the project I get the following error.

FodyPackaging: No weaver found at ..\Morris.AutoInject.Fody\bin\Debug\netstandard2.0\Morris.AutoInject.dll. Morris.AutoInject should have a Project Dependency on Morris.AutoInject, and Morris.AutoInject should target 'netstandard2.0'.

My project is here: https://github.com/mrpmorris/AutoInject

My csproj files' contents are

Morris.AutoInject.csproj

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <LangVersion>latest</LangVersion>
        <Nullable>enable</Nullable>
        <PackageId>$(MSBuildProjectName)</PackageId>
        <Title>AutoInject</Title>
        <Description>A reflection-free + convention-driven registration library for dependency injection.</Description>
    </PropertyGroup>

    <ItemGroup>
        <ProjectReference Include="..\Morris.AutoInject.SourceGenerators\Morris.AutoInject.SourceGenerators.csproj">
            <ReferenceOutputAssembly>False</ReferenceOutputAssembly>
        </ProjectReference>
        <None Include="..\..\..\Images\logo-small.png">
            <Pack>True</Pack>
            <PackagePath>\</PackagePath>
        </None>
        <None Include="..\..\..\README.md">
            <Pack>True</Pack>
            <PackagePath>\</PackagePath>
        </None>
        <None Include="..\Morris.AutoInject.SourceGenerators\bin\$(Configuration)\netstandard2.0\Morris.AutoInject.SourceGenerators.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="Fody" Version="6.9.1" PrivateAssets="None"/>
        <PackageReference Include="FodyPackaging" Version="6.9.1" PrivateAssets="All" />
    </ItemGroup>

</Project>

Morris.AutoInject.Fody.csproj

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <LangVersion>latest</LangVersion>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="FodyHelpers" Version="6.9.1" />
    </ItemGroup>

</Project>

Solution

  • PackageId must end with .Fody

    <PackageId>$(MSBuildProjectName).Fody</PackageId>
    

    Credit: https://github.com/Fody/Fody/issues/1308#issuecomment-2568800528