fody - No weaver found when trying to package my weaver - Stack Overflow

admin2025-05-02  0

I've followed the instructions here .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:

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>

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>
Share Improve this question asked Jan 2 at 12:49 Peter MorrisPeter Morris 23.4k12 gold badges97 silver badges168 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

PackageId must end with .Fody

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

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

转载请注明原文地址:http://anycun.com/QandA/1746119208a91933.html