NuGet / Home

Repo for NuGet Client issues
Other
1.49k stars 252 forks source link

Is there any way to transform Views/_ViewImports.cshtml on instaling nuget package for asp.net project #6207

Closed skofman1 closed 6 years ago

skofman1 commented 6 years ago

@WeihanLi commented on Wed Nov 15 2017

Is there any way to transform Views/_ViewImports.cshtml on instaling nuget package for asp.net project?

I wanna transform the file like transform web.config or app.config, but I don't know how.

jainaashish commented 6 years ago

You can always use msbuild targets to apply xdt transform files to transform web.config or app.config files.

Look at a sample solution - https://github.com/NuGet/Samples/tree/master/XDTransformExample You can also look at some documentation around it, but keep it in mind this docs was written keeping packages.config in mind so dont follow this documentation. Just get a idea from that and use targets to apply transform files.

WeihanLi commented 6 years ago

Hi @jainaashish .I've read the document,but the file I wanna change is not web.config or app.config.So I'm wondering if there is a solution for change any other files other than web.config or app.config

jainaashish commented 6 years ago

Not that NuGet provide anything out of the box. But you can try that with MSBuild targets if that can work for you.

WeihanLi commented 6 years ago

OK. I'll try. Thanks.