I changed publish setting, Items to deploy to "All files in this project". Publish not succeed due to error when coping Thumbs.db to temporary path before publish.
Error 49 Copying file help\GenderType_help\images\Thumbs.db to obj\Debug\Package\PackageTmp\help\GenderType_help\images\Thumbs.db failed. Could not find file 'help\GenderType_help\images\Thumbs.db'.
How could I get rid of these unwanted Thumbs.db files to be published.
After I could not find the exact answer this is what I done to contain all the files in copy project.
Changed Items to deploy to Only files needed to run this application.
Change Build action property of all files to Content
Then the all project files with in the copy project without having items to deploy to "All files in this project".
Find the file thumbs.db in your project solution explorer - might need to turn on the show all files setting. Delete the file Thumbs.db from the solution. Then Publish
You can make Windows stop creating them, here are two guides;
https://www.sitepoint.com/switch-off-thumbs-db-in-windows/
http://www.howtogeek.com/210764/fix-file-in-use-deletion-errors-on-network-drives-by-disabling-windows-thumbnail-generation/
Related
I'm having a very peculiar issue in Visual Studio when trying to publish my MVC Web App on IIS, Windows 10. It is trying to copy a file that no longer exists in my solution. This is the error:
Severity Code Description Project File Line Suppression State
Error Copying file obj\Release\AspnetCompileMerge\Source\Views\Demo\File.cshtml to obj\Release\Package\PackageTmp\obj\Release\AspnetCompileMerge\Source\Views\Demo\File.cshtml failed. Could not find file 'obj\Release\AspnetCompileMerge\Source\Views\Demo\File.cshtml'. Solution 0
This file does not exist anywhere in my solution so I am unsure as to why it's trying to copy this file. I've tried restarted Visual Studio, cleaning and rebuilding my solution, deleting the .vs folder, but all of this has been for naught.
Solution 1
After you deleted file from folder (Not in the visual studio) usually become this error message. the reason for your "projectname.CSPROJ" file already recorded your deleted file reference
Eg : <Content Include="Views\home\Index.cshtml" />
Then you can to delete that reference from in your "projectname.CSPROJ"
Solution 2
if you can see file in the project, You can right click on the file and Exclude file from the project
after that you can publish your project without error
I am using VS 2019 and was getting the same error.
For me the reason seems to be the solution location. The file path was exceeding 200 chars.
After I copied the solution in c: drive it started working for me.
Try,
Right Click -> App_Data -> Click Exclude from Project.....
If you get an error like this it's better just to migrate your project to a new solution, that's what I did.
When I add a folder to the visual studio project, it ignores it completely. It didn't do that until recently, and I am not entirely sure why this is. A clean build does not solve the problem, in the visual studio folder structure, the resources folder is present.
And in the latest build it is completely ignored.
To show it is not exuded from the project:
If the files are missing on a build server check the files are committed to your source control.
If the folder is empty, its not clear in your question if it is or not, you can either add a dummy.txt file or follow the instructions listed here. How to force MSBuild to copy empty folders in project?
If the files are missing from a publish you need to select all the files you want to publish, and change the "Build Action" to Content.
You cannot directly select a folder, you need to select the individual files.
Interesting post about the different options for build action:
What are the various "Build action" settings in Visual Studio project properties and what do they do?
Side Note
If you want your files to be published to the output direct on build. I.E. the bin folder. Then set the "Copy to Output Directory" to copy always or copy if newer.
Not sure why you would want to do this for css files though.
In the Visual Studio Solution Explorer right-click on on each files under resources folder and
select Properties > set build action to content.
I had to click the show all files button below the "Solution Explorer" text to see that I wasn't including anything.
I've run into this issue when trying to publish my application today that I have published many times before. I'm trying to publish to a directory.
The issue I have is, if I go to my app directory C:\www\clients\clientsite\app\clientproject\Properties\PublishProfiles where the error below says it can't find the file I can clearly see the git.pubxml file.
Copying file Properties\PublishProfiles\git.pubxml to obj\Release\Package\PackageTmp\Properties\PublishProfiles\git.pubxml failed. Could not find file 'Properties\PublishProfiles\git.pubxml'.
I've checked directory security settings and those are proper. I tried deleting my bin and obj but nothing is making a difference.
Often times the solution here is to edit the project file itself in notepad.
The trick to finding the afflicted path is to inspect the OUTPUT window, not the ERROR LIST window.
Once you find the afflicted file path, search for it in the project file and remove the reference.
In most cases the troublesome lines in the project file look like :
<Content include="{your path}" />
Continue to remove the includes until publishing works.
IMPORTANT: if you keep Visual Studio open while you're doing this, you must accept the "reload all" prompt.
I just ran into this after removing all unversioned files from my filesystem (which caused some .pubxml.user files to be lost.
If you right click the project node and click "publish", then select the publish profile that is causing problems, then simply close the publish dialog, Visual Studio will ask if you want to save changes... when you click yes, it regenerate the .pubxml.user file and everything works again.
Have you ensured that the file actually exists in the project? I have had problems working in a team where some file I wrote ended up not appearing in VS as a project file, so when we published, it didn't exist in the publish. If you can't find it inside VS, ensure that you are not debugging, and drop the file into the project file structure, then publish as normal.
VS was saying it couldn't find that file because the git.pubxml file in that directory was of type USER File and it needed to be PUBXML. When I added the correct file type from another version of that same project, I was able to publish the project again. I believe the PUBXML file was removed by mistake in source control.
It usually happens to binary files after updating it. Some packages remove it's own .xml and .pubxml files, while visual studio still believes that it is a part of the project.
What you need to do it to check for a Yellow Triangle besides the file name in the project directory tree, and remove that files, they're useless since your project compiles without errors.
try changing the publishing settings. if you check "Precompile during publishing" this will recreate your .pubxml.user file
I looked in Solution Explorer under the PublishProfiles section and found that the file was excluded and had a "!" by it showing a warning that the file wasn't found. I deleted it, then went into my Publish settings to edit a profile. I changed something (for me to compile files during publish.) Then I tried republishing the solution, and it worked!
i'm trying to package a deployment for Azure, but it is not packaging some files that are needed for the app to work properly. Those files are mostly PDFs and DOCXs.
If I go to the Package/Publish settings I have 3 options:
1. Only files needed to run this application. This is the default option which is excluding the PDFs and DOCXs.
2. All files in this project. This is including the missing files, but it is also including the code behind files (even though they are compiled). I do not want to include those files.
3. All files in this project folder. Haven't even tried this one because it will probably be worse than option 2.
My question is how do I set which extensions are actually needed to run this application?
Right after posting this question, I figured it out. For any out there with the same or similar problem here it goes...
In order to include certain files in the deployment package you have to set build action of those files to Content. Just right click on the file in solution explorer and click Properties. There change the Build Action to Content:
Also, you have to set the the setting of the Package/Publish to "Only files needed to run this application". The default option.
Using a Visual Studio 2010 ASP.net web application, I have several projects that share some JavaScript/css files. The most logical way for them to share these files is to place the files in a single folder and each project has them included with the "Add as Link" option. However, if I add the files this way when I'm debugging using either the Visual Studio Development server or debugging using a local IIS web server all requests for these files return 404 Not Found errors. If I publish the site then the files are copied but that obviously doesn't help with debugging.
Is there something I'm missing or is this a failing on VS's part?
To overcome this problem some time ago I created a 'MSBuild.WebApplication.CopyContentLinkedFiles' nuget package. This package adds MsBuild target which copies all content files added as link to project folder during build.
Note: if you use source control then it is better to add copied files (from Web Application folder) to ignore list.
I wouldn't really call that a failing, since you asked for that behavior in the first place: linked items in Visual Studio projects are actual links to external files. Those files can reside anywhere on the disk and are not copied into the project folder.
You might want to copy those files locally yourself during a pre-build event. That way, the files will remain synchronized and you won't duplicate them until your first compile.
The problem seems to be that the website runs right from your source folders, rather than from the bin folder. This means that the file will be missing, whether or not it is copied to the output folder.
It's probable that running from a local or remote web server would not have this problem, though I didn't get that working, and I'd rather not add IIS to my local machine if I don't have to.
Adding a pre-build copy command did work. Note that the current directory will be the bin folder. (You can use cd to echo the current directory to the build window if you want to see it):
If the file is in another solution, your command will look something like (three ..s: one to get out of each of bin, project, and solution folders):
copy ..\..\..\OtherSolution\OtherProject\Scripts\MyJSFile.js ..\Scripts\
If it's in the same solution, but a different project:
copy ..\..\OtherProject\Scripts\MyJSFile.js ..\Scripts
One minor issue is that the link to the file will collide with the new copy of the file, even if you don't add it to your project. As long as you make the link first, it seems to work. If you copied the file first, you'll have to manually delete the copy, and then refresh the solution explorer before before being able to add the link.
Select the link in Solution Explorer and then look at properties window and set Copy To Output Directory to Copy Always. Linked items are set to Do Not Copy by default.
BTW, you can copy many files as links very easily directly from Solution Explorer when using VSCommands 2010 extension.
See this blog post about a simple addition to your project file.
http://mattperdeck.com/post/Copying-linked-content-files-at-each-build-using-MSBuild.aspx