From other answers to this same question, it seems that this error is secondary to the real problem which is a missing source file. I am not using any source control. I have looked through my entire project and don't see any files with a warning icon, indicating it's missing. If there IS a file missing, what is it missing from?
How can I find the "missing" file? Isn't there any way of resetting this? My whole project is stuck on this.
I had this too. Close VS and reopen. Don't compile. The errors list should tell you which file is missing.
I too had this problem. My project was building in release mode but was not working in debug mode. I checked for all necesary files are included in my solution and I found that there is one file missing Settings.Designer.vb in My Project folder. I included these file in project and it build file in debug mode also.
Make sure that all aspx files are available in your solutions, otherwise check WebSite.vbproj, make sure maybe there is a file that is missing from your code, either add this file to the solution, or remove it from WebSite.vbproj. I recommend for you to use Notepad++ to open and modify WebSite.vbproj
Regards,
Luai
Another possibility is the existence of corrupted compiled dlls for the actual project (i.e. bin/<project>.dll) In my case, I just deleted the .dll and the .pdb and recompiled and the error went away.
Deleting removed files from the Solution Explorer, then rebuilding, solved it on my computer.
Related
"Type 'HR.Database' is not defined'
I get that error for several classes that are stored in the App_Code folder in the Error List panel when building my project.
It is a class I wrote with namespace HR
How can I reference it or alter the project to recognize those classes and remove the error?
I thought I should reference it but when trying to add a reference there are no items in the list of projects. Also, they are .vb files and not a .dll
I wasted the better part of a working day on this problem before figuring it out...
When you add files to App_Code, Visual Studio sets the "Build Action" property to "Content", instead of "Compile" which it does for all other classes. So your classes don't get compiled, and then VS complains that it can't find them. Presumably this is VS' way of saying that App_Code is not where you should put your app code, reasonable as it may appear.
The solution is to right-click on each file and reset "build action" to "compile". This also has to be done whenever you add files. Or you could submit to VS and put your source somwhere else.
< /frustration>
Since it's late and over 3 years old. I came across a similar issue. The solution above is perfect.
With newer VS IDE versions, go to App_Code file's properties and update the Build Action to 'Compile' if it's set as 'Content'. Using App_Code folder may be outdated in newer VS versions but some older developers still use the folder.
Replace vbproj and vbproj.user with your backup
My issue wasn't the App_Code folder in particular, but I was getting "not defined" errors in my Errors List until I double-clicked to open the file, then references would resolve and that error would disappear without me doing anything more, but when I tried to rebuild, all these errors would appear again.
The only real clue I had was that they were all related to the same project and when I dug through my Output window, I could see there was a conflict on the .Net framework versions. Once I resolved the version difference, the errors disappeared.
I was getting this issue for a slightly silly reason, but it might help for others to learn from my pain. :D
I was making the changes to the code in a tab of my test program, but that tab was for a VB file in a DLL I was using. Since those changes weren't being made/compiled in the DLL, it wouldn't find the class no matter how hard I tried until I opened the DLL project, made the changes there and rebuilt the DLL.
I had the same issue in Visual Studio 2019 but the .vb file already had "Compile" in properties > build action
I had tried rebuild, clean, deleting the file.
If I copied an existing class into this folder it would also not be recognised
Closing visual studio and restarting it fixed the issue, so there's a bug in VS where it doesn't compile files in a new folder until VS is restarted
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 publish an ASP.NET project in VS2010, and am getting the following error:
Copying file bin\CKFinder.pdb to obj\Release\Package\PackageTmp\bin\CKFinder.pdb failed. Could not find file 'bin\CKFinder.pdb'.
I had tried using a trial version of CKFinder (with CKEditor), but I backed it out. I removed all references to CKFinder, including the folders and the references - or so I thought.
Why is this error coming up? Ideas?
I also bumped to this problem. I was receiving the following error, when trying to publish MVCForum 1.7:
Copying file App_Data\NuGetBackup\Hello.txt to obj\Release\Package\PackageTmp\App_Data\NuGetBackup\Hello.txt failed. Could not find file 'App_Data\NuGetBackup\Hello.txt'.
François Breton's comment helped me achieve the solution.
It's simple:
Open your .csproj file with a text editor (Notepad, Notepad++) Visual Studio will open it as a project.
Press Ctrl + F and search for the file of the problem. In my case the file was "Hello.txt" without commas.
Under the <ItemGroup> it resided:
<ItemGroup>
<Content Include="App_Data\NuGetBackup\Hello.txt" />
<Content Include="Content\admin\Admin.css">
<DependentUpon>Admin.scss</DependentUpon>
</Content>
...More code omitted due to brevity.
I deleted the <Content Include="App_Data\NuGetBackup\Hello.txt" /> line, and voila! Visual Studio allowed me to Preview before publishing!
It will end like this:
<ItemGroup>
<Content Include="Content\admin\Admin.css">
<DependentUpon>Admin.scss</DependentUpon>
</Content>
...More code omitted due to brevity.
Update: I went into Project --> Package/Publish Settings, and clicked "Exclude generated debug symbols." The project began publishing with no issue.
Update #2 (this is probably the better answer): I tried to publish as debug instead of release (yes, I wanted to keep the debug features in this particular release), and the error came up again. It turned out that I did not exclude the CKfinder.dll from the project. Once I did so, it ran with no problem.
Me just removed yellow marked file from my visual studio solution & it worked greatly for me because files were added and removed many times from folders but its not removed from VS solution project.
Delete file showing exclamation mark in the solution explorer. It worked for me
I ran into same problem, i just clicked show all files, and deleted the files that had exclamation mark with them. Hope this helps someone.
Right click on your project => unload project => right click again on your newly unloaded project => edit 'myProject.csproj' => Search for the offending files (CTRL + F) and remove.
If the error appears again within the same parent directory, but now under a different file name, it could be that a user has mistakenly included a file in the project (like I did). All files under the offending directory can be removed. This should solve the problem.
In my case I got a similar error but with .cshtml files like this:
copying to Views\Home\About.cshtml to
obj\Release\Package\PackageTmp\Views\Home\About.cshtml failed. Could
not find file 'Views\Home\About.cshtml'
Looking at the Solution Explorer tree everything seemed fine with no yellow markings but when clicking on a file it gave an error.
The item 'About.cshtml' does not exist in the project directory. It may have been
moved, renamed or deleted.
Removing the files from Solution solved it for me.
You must exclude bin folder from project, then republish your project. the way can solve my problem
I mistakenly included obj Folder to Visual Studio Project. Excluding Obj folder from project fixed my issue
Check for bin folder is added in vs explorer. If it was there then exclude from project and check. It worked for me.
I had files inside of my directory I intended to publish to. Deleting these allowed for a successful publish.
Another solution is to delete publish profile, this error happened to me after I deleted 1 of the EF DbContext. The solution keep track of that file inside publish folder, I recreated the profile and publish successfully.
My error was this
No DbContext named 'xxxx' was found.
These problems occur when the bin file is included in the project, note that if the bin folder exists in your solution, exclude it.
In one of my VS projects I get this error when I modify a css file in a App_Themes catalog in runtime.
CS0042: Unexpected error creating debug information file '[..]\Temporary ASP.NET Files[..]\App_Theme_MySite.pdb: The process cannot access the file because it is being used by another process.
I've used the Process Explorer and concluded that the file is being locked by the devenv.exe file.
In order to proceed I have to restart the entire project.
It only happens in this one project and I have been unable to find what differs from other projects where I don't have this problem.
Solution running, css modification, solution crashes.
Any ideas?
I'd similar issue.
Just remove the attribute or change it false.
<!--web.config --><configuration><system.web><compilation optimizeCompilations="false"
Found solution too....after 6-8 hours...
I have imported an existing project into flex but any changes I make to the source are not being built and displayed when I test run the application. The original files which are in the bin-debug folder dont seem to be changing at all.
I have tried cleaning the project, deleting the bin-debug folder even reinstalling flex builder, but nothing has solved the problem.
I've read this post which was about the same problem but none of the advice helped.
Any advice would be appreciated.
When you imported the project did you do a default import (copies everything into your workspace) or an "Existing Projects into Workspace" import?
If you did the default (listed as "FlexBuilder/Flex Project" under the import source) then you might be changing the wrong code. If you're looking in the original project's location for the SWFs to run then you're in the wrong place, as the SWFs you build will be in the new location.
One quick way to test to see if your code is actually being compiled would be to intentionally put a compile error in there. If the compiler chokes on it then your code is being compiled.
There's another thing you can try. I just ran into a weird issue where FB was caching a compile error, and even after fixing the file it still showed the error. Even after doing a clean, restarting FB, etc.
I found a place where FB caches information for the project, and for some reason it wasn't clearing things it should. It's possible your project's cache got messed up and it's messing up the compile somehow. You can try deleting it (might need to delete and re-import your project though).
The cache is at:
workspace.metadata.plugins\org.eclipse.core.resources.projects\
I just made a blog post about this, in case you'd find it useful.