Git Product home page Git Product logo

unoptimized-assembly-detector's Introduction

Alerted Snail

Unoptimized Assembly Detector

build NuGet

NuGet package that detects when assemblies compiled without the -optimized flag are added to a project and warns you about it.

How does it work?

This project hooks into the build process and detects if any referenced assembly was compiled in Debug mode.

UnoptimizedAssemblyDetector in action

Add to your project:

<ItemGroup>
  <PackageReference Include="UnoptimizedAssemblyDetector" Version="0.1.1" PrivateAssets="All" />
</ItemGroup>

Motivation

It's surprising to many that dotnet publish and dotnet pack compile assemblies in debug mode. This means that unless you've specified -c release, you're building .NET assemblies without the -optimize compiler flag.

With this package, you can get warned if one of your dependencies is being built in Debug mode and published to nuget.org. It can warn any referened assembly, not only added through NuGet.

Now that you know about it, you can communicate to the author of the dependency. Wait until a fix is shipped, you can ignore the warning for said package, roll back to an older version or chose another dependency.

I wrote a blog post that goes into more details on the topic.

Acknowledgements

unoptimized-assembly-detector's People

Contributors

bruno-garcia avatar aalmada avatar

Stargazers

Carlito avatar Tiago Filipe Silva avatar Craftzman7 avatar Marius Ungureanu avatar M. Scott Ford avatar Bruno Caimar avatar Tim Y Davies avatar Kirill Osenkov avatar  avatar Victor Fialkin avatar Jason avatar  avatar  avatar João avatar Will Fuqua avatar Justin Hachemeister avatar Ajay Mehta avatar Viktor Svub avatar Piero Castillo avatar Damian Romanowski avatar Cédric Luthi avatar Myuu avatar Martin Björkström avatar Loïc Sharma avatar  avatar ROG avatar Joao Grassi avatar Tom Pažourek avatar Jean-David Moisan avatar Oleksii Holub avatar Dhiogo Brustolin avatar LucasZF avatar

Watchers

Justin Hachemeister avatar  avatar  avatar

Forkers

zhouzu aalmada

unoptimized-assembly-detector's Issues

Dependency Issue

No dice first time I tried this. Build works fine without this package referenced. .Net Core 3.1 Windows 10

9>Failed checking if assembly is optimized: D:.nuget\packages\amazon.aspnetcore.dataprotection.ssm\2.1.0\lib\netstandard2.0\Amazon.AspNetCore.DataProtection.SSM.dll
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: The "DetectUnoptimizedAssembly" task failed unexpectedly.
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: File name: 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: at UnoptimizedAssemblyDetector.DetectUnoptimizedAssembly.CheckAssemblyIsOptimized(String assemblyPath, String file)
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: at UnoptimizedAssemblyDetector.DetectUnoptimizedAssembly.Execute() in /_/src/UnoptimizedAssemblyDetector/DetectUnoptimizedAssembly.cs:line 81
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
9>D:.nuget\packages\unoptimizedassemblydetector\0.1.1\build\UnoptimizedAssemblyDetector.targets(14,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.