Exclude files from web site publish in Visual Studio

后端 未结 11 1924
醉话见心
醉话见心 2020-11-27 12:44

Can I exclude a folder or files when I publish a web site in Visual Studio 2005? I have various resources that I want to keep at hand in the Solution Explorer, such as alte

11条回答
  •  独厮守ぢ
    2020-11-27 13:06

    As a contemporary answer, in Visual Studio 2017 with a .net core site:

    You can exclude from publish like so in the csproj, where CopyToPublishDirectory is never.

      
        
          PreserveNewest
          PreserveNewest
        
        
          PreserveNewest
          Never
        
      
    

    This is discussed in more detail here: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/visual-studio-publish-profiles?view=aspnetcore-2.2

    
        appsettings.Local.json
    
    

    The earlier suggestions did not work for me, I'm guessing because visual studio is now using a different publishing mechanism underneath, I presume via the "dotnet publish" cli tool or equivalent underneath.

提交回复
热议问题