Domanda

I have a web setup project and a web site included in the same sollution. In the setup project, I have added Content files pointing to the web site content.

In this web site there are some folders that contains dynamically generated files (i.e .log files, some image files etc.) I do not want these files to be included in the setup. I have tried to add a filter Symbols\*.png but this does not work. I have also tried a filter called *.png, and this excludes the .png files within that folder, but the problem is it also excludes all static .png files in the web site that must be there.

How can I add a filter that excludes only the files under the directory I want?

Is it possible to call something in the PreBuildEvent after the files are deleted that will tell VS to refresh the web site content?

Are there any other approaches that can solve this?

È stato utile?

Soluzione 2

As a workaround, I have created a PreBuildEvent that deletes all the files that should not be included in the setup:

del /Q $(ProjectDir)..\..\MyWebSite\Symbols\*.png

This actually deletes the files when I start the build, but it causes an error later in the build, because some content files does not exist that the setup content thinks should be there. The files that are deleted, are still referenced in VS as content in the web site. If I browse the folders in the web site, I see that the deleted files are there in the VS GUI (although the files are actually deleted). I have to do a refresh on the web site project to tell VS that the content has changed, and then do the build again. Then it works, and my setup contains what I want.

Altri suggerimenti

Have you tried to edit your .csproj file with notepad and add something like:

<ItemGroup>
  <!-- This will exclude the .png files from the Symbols folder -->    
  <ExcludeFromPackageFiles Include="$(ProjectDir)..\..\MyWebSite\Symbols\*.png" />   
</ItemGroup>

where ItemGroup is after the following line:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

More info you can find in the following article: http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top