asp.net - How to avoid my own nuget package overwrite the target project web.config and global.aspx file when they install my package -
i created 1 nuget package using following step.
- first created 1 asp.net mvc application
- the created spec file using nuget spec command
- then edited $id$,$version$,$author$,$description$ ect..
- then created package using following command.
- nuget pack myproject.csproj -build -properties configuration=release
- it created 1 myproject.1.0.0.0.nupkg
- then copy file , past c:\localnugetfeed\myproject.1.0.0.0.nupkg
- i configure local repository in vs
my problem is when install package other project ask following question. per requirement don't want move file target project. suppose user give y overwrite target project file because of face lot reference problem.
**file conflict file 'web.config' exists in project 'crm'. want overwrite it? [y] yes [a] yes [n] no [l] no [?] (default "n"): file conflict file 'global.asax' exists in project 'crm'. want overwrite it? [y] yes [a] yes [n] no [l] no [?] (default "n"):** but in package don't want move above 2 file package target project.
is way avoid transform global.asax , web.config move package target project.
in .nuspec file added following line
<files> <file src="web.config" target = "" exclude="web.config"/> <file src="*.asax" target = "" exclude="*.asax"/> <file src="content\*.css" target="content\" /> <file src="scripts\*.js" target="content\scripts\" /> </files> but include web.config file , global.aspx file in content folder resultant package bellow
myproject.1.0.0.0 >> content ....css >>script ..js file web.config global.asax
take @ .nuspec file. it's xml file, can open text editor. see how define files include @ <package><files>? remove files don't want. handy tool if want gui nuget package manager.
Comments
Post a Comment