ASP.NET installation project - how to include static files not in VS?

I am working on an ASP.NET MVC web application and working on a part of the web setup. We use SVN for version control. One of the problems is that we currently have web designers who modify and add a lot of html, css and js files that fall into the content folders, but they do not add them to the VS project, so new files are not included into the installer.

One option is that we should try to teach them to always enter VS and manually add files, but we are in a big project and it starts to shrink, so I try to let people learn something new in technology that they don’t know will lead to too many errors, so I would like to get around this if possible.

Is there a way to get the installation project just to include files from a folder in the file system, and not in the files designated by the project?

Thanks!

+4
source share
3 answers

I think I get it:

Verify that the installer project includes content files for the web application. Then go to the csproj file of the web application with a text editor and find the ItemGroup where the static content files are listed. Then add an entry with a wildcard in it, and the installer will pack them.

<ItemGroup> <Content Include="Content\test.html" /> <Content Include="Content\*.html" /> <Content Include="Content\*.gif" /> <Content Include="Content\*.css" /> <Content Include="Content\*.jpg" /> <Content Include="Content\*\*.js" /> 
+3
source

Right-click on the folder in the "File System" view of the "Web Setup" project and select "Add", "File ..."

It doesn't seem like you can add the entire folder this way, although you will have to add each file to the installer.

EDIT:

Are all the files from your project folder included in the WebSite project in Visual Studio? Then this is just the case when your WebSite project and Web Setup project are in the same solution, then right-click the web application folder in the Web Setup project, select Add, Project Output ... and then select the WebSite project in the drop-down list and Content Files from the list and click "OK."

+1
source

Unfortunately, I don’t think it could be out of the box, since projects support file links separately.

You can achieve what you need with a custom macro, or ask another command to edit the .csproj XML file (possibly simpler or riskier, depending on their background).

0
source

All Articles