Hi All: I just ran into an issue where a website I'm publishing using webdeploy from VS2010 is putting certain folders/files in the bin diretory instead of the root of the website where they exist. It used to put them in the correct place...not sure what
I changed to create this behavior?
The folder in question has PDFs in it...if I drag a PDF from Windows Explorer into Solution Explorer it copies it into the project, but the default "build action" for the PDF is "do not copy"...if I manually change it "copy if newer" it does upload the PDF
when I publish.
my output log shows:
Copying all files to temporary location below for package/publish:
obj\Release\Package\PackageTmp.
Start Web Deploy Publish the Application/package to https://[website]:8172/msdeploy.axd?site=forms ...
Updating setAcl (forms).
Updating setAcl (forms).
Updating filePath (forms\bin\forms.dll).
Updating filePath (forms\bin\forms.pdb).
Updating filePath (forms\bin\forms.xml).
Adding child filePath (forms\bin\pdfTemplates\Kit.pdf).
Updating setAcl (forms).
Updating setAcl (forms).
Publish is successfully deployed.
the folder "pdfTemplates" is in the root of the project...but I see it now in the "bin" directory as well...what is causing it to be placed there?
I think you've confused two different property fields. The Copy To Output Directory has values of "Do not copy" and "Copy if newer". For your web project content, you want this to be "Do not copy". Why? Because the Output directory refers
to /bin (i.e. where the build output, your project .dll file, ends up).
Instead you need to set the Build Action property to "Content" and it will include it in publishing. By default in VS2010, any files that VS didn't know about would default to Build Action = None, which is ignored at publishing time.
If this post has solved your problem, please select 'Mark as answer'
- Jimmy Lewis
Microsoft SDET
Visual Web Developer Team
I think you've confused two different property fields. The Copy To Output Directory has values of "Do not copy" and "Copy if newer". For your web project content, you want this to be "Do not copy". Why? Because the Output directory refers
to /bin (i.e. where the build output, your project .dll file, ends up).
Instead you need to set the Build Action property to "Content" and it will include it in publishing. By default in VS2010, any files that VS didn't know about would default to Build Action = None, which is ignored at publishing time.
Just a followup question...in a VS2010 VB.NET project, is there any way to specify that all PDF files be included when deploying? I realize that multiple PDFs can be selected at once and set to "content", but I don't want to have to do this manually every
time new PDFs are added.
I found a couple of threads on stackoverflow about manually editing the CSPROJ file to map PDF to "content" action, but I was wondering if there's a way to do it in the project settings? I noticed under "package/publish web" there's an "Items to deploy"
dropdown that defaults to "only files needed to run this application". The other options are "all files in this project" and "all files in this project folder"...will either of those settings force PDFs to be deployed?
I often exclude test webpages, so I don't want excluded files to be deployed accidentally.
I don't know of a feature built-in to VS that would support that. You could consider writing a macro or an add-in or something to edit each file.
The Build Action field for each file is determined either by the project template (when you create the project), or by the project type that you're using (e.g. Console app vs. Class Library vs. Web Application can all have their own behaviors). In VS2010,
pretty much all project types default to "None" unless it's a file type they recognize (e.g. .vb files get set to Compile, or .aspx files as Content). In VS2012, we changed the Web Application projects to default to "Content" for all files, becaues we've
found that a lot of folks have content file that they usually want to include (e.g. .zip files, .pdf files, .foo files, ...). As far as I know, all other project types remain with Build Action="None" as the default.
Side note: in VS2012 you'll need to exclude the test pages/content that you don't want to be deployed. However, if you are using the Web Publishing feature, instead of setting the Build Action to "None" there are now ways to exclude files during publishing
only (through the UI, there's a File Preview where you can unselect files; through the command line, there's a parameter you can pass in during publishing). These new features are also available in VS2010 with the Azure SDK.
If this post has solved your problem, please select 'Mark as answer'
- Jimmy Lewis
Microsoft SDET
Visual Web Developer Team
dotnetnoob
Member
401 Points
732 Posts
Publishing puts files/folders in "bin" directory instead of "root"?
Oct 22, 2012 08:44 PM|LINK
Hi All: I just ran into an issue where a website I'm publishing using webdeploy from VS2010 is putting certain folders/files in the bin diretory instead of the root of the website where they exist. It used to put them in the correct place...not sure what I changed to create this behavior?
The folder in question has PDFs in it...if I drag a PDF from Windows Explorer into Solution Explorer it copies it into the project, but the default "build action" for the PDF is "do not copy"...if I manually change it "copy if newer" it does upload the PDF when I publish.
my output log shows:
the folder "pdfTemplates" is in the root of the project...but I see it now in the "bin" directory as well...what is causing it to be placed there?
jamlew
Participant
1977 Points
256 Posts
Microsoft
Re: Publishing puts files/folders in "bin" directory instead of "root"?
Oct 23, 2012 05:26 PM|LINK
I think you've confused two different property fields. The Copy To Output Directory has values of "Do not copy" and "Copy if newer". For your web project content, you want this to be "Do not copy". Why? Because the Output directory refers to /bin (i.e. where the build output, your project .dll file, ends up).
Instead you need to set the Build Action property to "Content" and it will include it in publishing. By default in VS2010, any files that VS didn't know about would default to Build Action = None, which is ignored at publishing time.
- Jimmy Lewis
Microsoft SDET
Visual Web Developer Team
dotnetnoob
Member
401 Points
732 Posts
Re: Publishing puts files/folders in "bin" directory instead of "root"?
Oct 23, 2012 06:00 PM|LINK
Thanks jamlew...I never understood that distinction until now!
dotnetnoob
Member
401 Points
732 Posts
Re: Publishing puts files/folders in "bin" directory instead of "root"?
Nov 30, 2012 03:35 PM|LINK
Just a followup question...in a VS2010 VB.NET project, is there any way to specify that all PDF files be included when deploying? I realize that multiple PDFs can be selected at once and set to "content", but I don't want to have to do this manually every time new PDFs are added.
I found a couple of threads on stackoverflow about manually editing the CSPROJ file to map PDF to "content" action, but I was wondering if there's a way to do it in the project settings? I noticed under "package/publish web" there's an "Items to deploy" dropdown that defaults to "only files needed to run this application". The other options are "all files in this project" and "all files in this project folder"...will either of those settings force PDFs to be deployed?
I often exclude test webpages, so I don't want excluded files to be deployed accidentally.
jamlew
Participant
1977 Points
256 Posts
Microsoft
Re: Publishing puts files/folders in "bin" directory instead of "root"?
Nov 30, 2012 04:53 PM|LINK
I don't know of a feature built-in to VS that would support that. You could consider writing a macro or an add-in or something to edit each file.
The Build Action field for each file is determined either by the project template (when you create the project), or by the project type that you're using (e.g. Console app vs. Class Library vs. Web Application can all have their own behaviors). In VS2010, pretty much all project types default to "None" unless it's a file type they recognize (e.g. .vb files get set to Compile, or .aspx files as Content). In VS2012, we changed the Web Application projects to default to "Content" for all files, becaues we've found that a lot of folks have content file that they usually want to include (e.g. .zip files, .pdf files, .foo files, ...). As far as I know, all other project types remain with Build Action="None" as the default.
Side note: in VS2012 you'll need to exclude the test pages/content that you don't want to be deployed. However, if you are using the Web Publishing feature, instead of setting the Build Action to "None" there are now ways to exclude files during publishing only (through the UI, there's a File Preview where you can unselect files; through the command line, there's a parameter you can pass in during publishing). These new features are also available in VS2010 with the Azure SDK.
- Jimmy Lewis
Microsoft SDET
Visual Web Developer Team