1

Currently have an issue where my project is using both WebGrease and AjaxMin. Im trying to change the settings of AjaxMin using the CodeSettings class which exists in both AjaxMin and WebGrease. For whatever reason I can't tell it to use the AjaxMin class instead of WebGrease and I was hoping for some help.

using Cassette;
using Cassette.Scripts;
using Cassette.TinyIoC;

namespace Sandhills.ListingInput.MVC
{
    /// <summary>
    /// Configures the Cassette asset bundles for the web application.
    /// </summary>
    public class CassetteBundleConfiguration : IConfiguration<BundleCollection>
    {
        public void Configure(BundleCollection bundles)
        {
            bundles.Add<ScriptBundle>("main.js", ReactConfig.Files);
        }
    }

    public class CustomCassetteServices : IConfiguration<TinyIoCContainer>
    {
        public void Configure(TinyIoCContainer container)
        {
             var settings = new Microsoft.Ajax.Utilities.CodeSettings();
             settings.AddNoAutoRename("SpecValue");
             container.Register<IJavaScriptMinifier>(new MicrosoftJavaScriptMinifier(settings));
        }
    }
}

As you can see in the bottom most function Configure I directly reference

Microsoft.Ajax.Utilities.CodeSettings

but im still getting the error Severity Code Description Project File Line Suppression State Error CS0433 The type 'CodeSettings' exists in both 'AjaxMin, Version=4.84.4790.14405, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f' and 'WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35' Sandhills.ListingInput.MVC C:\sandhills\SandhillsSoftware\Web\ListingInput.MVC\Dev-Jordan\ListingInput.MVC\CassetteConfiguration.cs 22 Active

Shawnzey
  • 196
  • 1
  • 14

1 Answers1

1

I added an alias of "Settings" to the AjaxMin reference and added the code

extern alias Settings;

then simply reference the class through the alias like this

Settings.Microsoft.Ajax.Utilities.CodeSettings();
Shawnzey
  • 196
  • 1
  • 14