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.

  1. first created 1 asp.net mvc application
  2. the created spec file using nuget spec command
  3. then edited $id$,$version$,$author$,$description$ ect..
  4. then created package using following command.
  5. nuget pack myproject.csproj -build -properties configuration=release
  6. it created 1 myproject.1.0.0.0.nupkg
  7. then copy file , past c:\localnugetfeed\myproject.1.0.0.0.nupkg
  8. 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

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -