Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a simple way to turn off including multiple language packs when using Nuget?

I'm using nuget and am downloading the AjaxControlToolkit. The problem I have is that I don't want 20 extra folders to be created in the bin directory for different languages. Each folder only has a single file named 'AjaxControlToolkit.resources.dll' in it. I don't need the extra folders as our app will never be used with anything but English.

The only way that I've been able to omit the files is to follow this: http://blogs.msdn.com/b/webdev/archive/2010/04/22/web-deployment-excluding-files-and-folders-via-the-web-application-s-project-file.aspx where you have to manually add a line to the actual project file. I feel like there should be a better way to do this.

EDIT: This is the line that I currently add to my .csproj file:

<ExcludeFoldersFromDeployment>Bin\ar;Bin\cs;Bin\de;Bin\es;Bin\fr;
    Bin\he;Bin\hi;bin\it;bin\ja;bin\ko;bin\nl;bin\pl;bin\pt;
    bin\ru;bin\tr-TR;bin\zh-CHS;bin\zh-CHT</ExcludeFoldersFromDeployment>
like image 277
Dilbert789 Avatar asked Nov 21 '13 19:11

Dilbert789


People also ask

Is NuGet owned by Microsoft?

NuGet was created in 2010 (under the name “NuPack”) by the Outercurve Foundation, a non-profit founded by Microsoft. The goal of this foundation was to "enable the exchange of code and understanding among software companies and open source communities." The Outercurve Foundation was a precursor to the current .

What is the .NuGet folder?

The global-packages folder is where NuGet installs any downloaded package. Each package is fully expanded into a subfolder that matches the package identifier and version number. Projects using the PackageReference format always use packages directly from this folder.

Where are NuGet dependencies stored?

The information about the NuGet package dependencies for your project is stored in this . csproj file. NOTE: For . NET Framework projects and more generally for non-SDK-style projects, the package dependencies are by default stored separately in a packages.

What is NuGet package manager and how does it work?

NuGet provides the tools developers need for creating, publishing, and consuming packages. Most importantly, NuGet maintains a reference list of packages used in a project and the ability to restore and update those packages from that list.


2 Answers

No you cannot switch this "feature off" Nuget simply downloads the archive package and places the files where thee package information file says the files are to go.

You need to manually omit these files yourself - or, build your own AjaxToolKit from their source with the extra languages omitted in advance.

like image 71
Dave Gordon Avatar answered Nov 03 '22 15:11

Dave Gordon


I had the same problem (similar answer here) and I haven't found a better way to do it either, I pursued the same method you mentioned however for some reason "ExcludeFoldersFromDeployment" didn't seem to work for me, but I found a alternative way to do the same thing though:

<ItemGroup>
    <FluentValidationExcludedCultures Include="be;cs;cs-CZ;da;de;es;fa;fi;fr;ja;it;ko;mk;nl;pl;pt;ru;sv;tr;uk;zh-CN;zh-CHS;zh-CHT">
        <InProject>false</InProject>
    </FluentValidationExcludedCultures> 
</ItemGroup>

<Target Name="RemoveTranslationsAfterBuild" AfterTargets="AfterBuild">
    <RemoveDir Directories="@(FluentValidationExcludedCultures->'$(OutputPath)%(Filename)')" />    
</Target> 

(Basically I put custom build events to clear out the extra files by deleting them after the build is run...)

like image 2
David Rogers Avatar answered Nov 03 '22 15:11

David Rogers