6

I have done this many times with many projects on the same machine, but for some reason the following is not working for me:

  1. Add desired DLL (filehelpers in this case) from NuGet package manager
  2. Install Costura.Fody (by default it includes Fody 2.0.6; 2.0.7 is available I tried both versions which produced the same result)
  3. Use Package Manager Console to run command Install-CleanReferencesTarget (copy/pasted from https://github.com/Fody/Costura)

When I get to step three (which has always worked up until now) I get the following error:

PM> Install-CleanReferencesTarget
Install-CleanReferencesTarget : The term 'Install-CleanReferencesTarget' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Install-CleanReferencesTarget
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Install-CleanReferencesTarget:String) [],
                              CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I have tried recreating the project, restarting my PC, restarting VS, running VS as admin, etc but same result. I also verified the DLL in question (FileHelpers.dll) is set to copy local.

I also looked at the FodyWeavers.xml file in another project that included the same DLL and didn't have this issue, and that it is identical to the one in this troublesome project:

<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
  <Costura/>
</Weavers>

Does anyone know why this is happening all of a sudden?

3
  • Do you mean that the command line:Install-CleanReferencesTarget can be executed successfully on another project? As a workaround, you can use the target in the project file: <Target AfterTargets="AfterBuild;NonWinFodyTarget" Name="CleanReferenceCopyLocalPaths" > <Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" /> </Target> It seems like the command line is not supported by the NPM, you can also submit this issue here:github.com/Fody/Costura/issues. Commented May 5, 2017 at 8:51
  • Correct this is the first time it has not worked. Where exactly do I put that <Target> block? Within the <Costura> tag? That is where I placed it but cleaning/building the solution does not bundle the DLL. Commented May 5, 2017 at 16:44
  • No, the <Target> block should be put in the your project file (Right click project->unload the project->Edit the .xxproj file). Commented May 8, 2017 at 1:23

3 Answers 3

4

As per the latest doc, it seems to have been removed in newer versions, which will automatically enable the feature. Clean-up can be disabled by changing the Costura configuration file.

DisableCleanup

As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.

Defaults to false

<Costura DisableCleanup='true' />

See also this post for more details on configuration options.

Sign up to request clarification or add additional context in comments.

Comments

1
  1. Open the NuGet Package Management Console (View->Other Windows) and use the command line options, from here: Creating And Publishing A Package[^]
  2. Compile this from the source: NuGet Package Project extension[^] (source is here: Home[^])

Comments

0

Not an answer as such, but I've just had the same issue and managed to find a work around.

In the end, rather than use the cmdlet, I added the Target to my proj file from the bottom of here. This seems to have worked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.