0

I am using Visual Studio 2019 and trying to exclude wwwroot\js\src files from getting copied to IIS when publishing. Similar questions have been asked but those what I have referred to don't work because some of the project file syntax shown in those examples are not valid. Even the Microsoft documented method is not working.

MS Official documentation - wpp.target files has no effect on publish. It still copies the wwwroot\js\src files.

This - In vs 2019; CopyToPublishDirectory is not a valid attribute to Content tag. However the valid syntax below:

<ItemGroup>
     <Content Update="wwwroot\js\src\**"> 
          <CopyToPublishDirectory>false</CopyToPublishDirectory>
     </Content>
</ItemGroup>

still publishes the js\src folder to IIS.

This - doesn't help either.

This must be quite a simple task and yet not straight forward way to get it done. Any help is appreciated.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user2058413
  • 691
  • 3
  • 10
  • 28

1 Answers1

0

Well,

This syntax worked after I add it to the csproj file. However the according to intellisense says it's invalid, but it works. Seems to be an issue on Microsoft side

<ItemGroup>
  <Content Update="wwwroot\js\src\**\*">
    <CopyToPublishDirectory>Never</CopyToPublishDirectory>
  </Content>
</ItemGroup>

The tooltip says CopyToPublishDirectory can only have a boolean value of true/false and If I do that this doesn't work!

user2058413
  • 691
  • 3
  • 10
  • 28