In Visual Studio 2010, I have just one project that cannot be published using the "Publish Now" button.
If I publish using the menu option instead, it works fine. I can then increment the version number, click "Publish Now" (or use "Publish Wizard..."), and get this error:
Cannot publish because a project failed to build.
However, no other error message is given. I managed to get screenshots of the output screen before it clears and flips to the Error List tab, but there is no mention there of any error. Clean & Rebuild doesn't fix the problem.
What do these two options do differently? Why is the build failing one way but not the other?
Since "rebuild solution" and "clean Solution" are not solving these issues, it might be either logs or assemblies in Bin.
This error seems to be caused by various issues :
Solution 1. set the build log verbosity to Diagnostic from the menu Tools->Options->Project and Solutions->Build and Run in Visual Studio 2010.
After that, if you build and publish your project, you can see the detailed build log from the Output window. From there, we should get futher information about why it failed to build.
Solution 2. Do you have Google Desktop by chance? If you do, close the sidebar and try once.
Solution 3. Click here for an another solution
Solution 4. Do you work with people from other timezones ? Files modified in future time may also cause this issue. check this utility
Solution 5.
I suggest you to try running the Visual Studio in safemode that will force the visual studio loading only the default environment and services, and shipped versions of third party packages. If the problem disappears you may stuck with some version of IDE tools with bugs. update them then.
If nothing seems to work, try this.
*Solution 6*
After researching it, it appears that the built in build/publish script that Visual Studio (2010 in our case) uses has a flaw in the order that it does things. Most importantly it runs a cleanup on the OBJ directory deleting the target EXE file before the publish step can grab it.
The solution
This is somewhat of a hacky workaround, but it solved the problem for me.
The fix is to copy the file back to the /obj/ folder from the /bin/ folder right before the publish step. Unfortunately there is no way that I know to specify a BeforePublish event through the IDE, so you will have to edit the .vbproj file in a text editor.
Add the following section just before the final tag.
<Target Name="BeforePublish">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(IntermediateOutputPath)" />
</Target>
Clean and Rebuild worked for me. It seems like Google desktop and some browser extenstions causing this bug often. looking for a security update is good way to go with this.
I eventually created a new branch, and that branch did not have this problem. I never discovered what the actual cause was.
Related
Did anyone of You had the same problem as described below? If so, do you have any tip or solution for this?
I have a problem with my local environment. Every time I try to build the solution, a lot of its projects are being skipped and I receive many CS0006 errors: "Metadata file (...) could not be found".
Another thing I noticed is ribbon with message "Current solution contains incorrect configurations mappings. It may cause projects to not work correctly. Open the Configuration Manager to fix them." When I open Configuration Manager, all projects of solution are checked, and everything seems to be correct there.
I use Visual Studio 2022 (64-bit), version 17.4.1 and .NET Framework version 4.8.04084.
I tried almost all recommendations from the Internet, including uninstalling and installing again Visual Studio or reuploading of repository, but there is no update about this problem.
Thank You in advance.
You could try the steps provided by Sabah Shariq.
Right click on the solution and click Properties.
Click Configuration on the left.
Make sure the check box under "Build" for the project is checked. If check then uncheck and check again and save the settings.
Clean the solution by right clicking on the project solution and rebuild the project again.
Make sure you don't have any other error messages in your project and if you do, fix those first!
For more information, please refer to:
Error CS0006_Metadata file could not be found
Thank you for your help. I have found the cause of this problem by myself. It turned out that some lines of code was removed from sln file by mistake (in my opinion there was an error of Visual Studio). When I re-added them, the solution is able to be built.
Anyway, thank you for your support.
I am trying to set a breakpoint in JetBrains Rider, but the debugger isn't breaking.
I know for sure the application should reach the code I'm trying to break on, as changing string literals appears in the program.
I have completely reinstalled all my JetBrains programs (wiping settings). I've also tried every answer in this thread: break point is not hitting while debugging, with no luck.
This bug doesn't occur in Visual Studio, but does occur with any project in Rider.
It also doesn't happen on my other copy of Rider that I use on my other PC.
I appreciate any help, thanks!
One more caveat: I started using Rider again after an absence, I was pressing the "play" (triangle) button rather than the button with a picture of a bug.
(D'oh!)
For .Net Framework projects:
This can happen if Rider attached the debugger to a different process than the process that IIS is using.
Open Run on Rider menu and click on "Attach to process" or ctrl+alt+F5
Type w3wp, this will find all the processes IIS is running on. If you found multiple processes you can hover on them to see which AppPool is related to that process.
Click on the process to attach debugger to it.
The breakpoint should be hit now.
And make sure you are using the URL that Rider provides you when you run your project (http://localhost:XXXX), because the URL that Rider uses might be different than the Host Name you set for your IIS.
I've found what was causing it.
As of Rider 2018.1.3, the solution you're running must be on the same disk as the copy of Rider you're using.
This issue is referenced on JetBrains support here.
You can temporarily solve this by either moving your solution to the same drive, or by reinstalling Rider.
What I did before was :
Open the solution
Set some breakpoints
Click the 'bug' button in Rider (next to the play button)
Chrome would open up automatically with an URL pointing to my services
The service would work as expected, but breakpoints would not work
Stop the service
Modify some code
Start the service
Refresh the Chrome Windows from step 4
I would see the modifications in Chrome. But no breakpoints would get hit.
Now the only thing I changed is that in after step 2 I now do a
Run --> Attach to a local process... --> w3wp
After this, I just do the same steps as before, but now the breakpoints do get hit...
Refrence
For anybody who has the same problem in Xamarin Android project.
For me the breakpoints in the android project where working, like in the main activity but not in the shared project.
How i fixed it:
Go to your android.csproj file and edit it. Search your build target and check for <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
If this is true, breakpoints in additional modules are not working.
Set it to false, or even better, remove this line completely.
In relation to Jessica's answer above, it appears that opening a solution in Rider using the System absolute path (i.e. /System/Volumes/Data/Users/...) appears to act as though it's on a separate drive.
After driving myself crazy for about four hours, I created a new solution and changed the solution directory from the system path to /Users/... then copied my project to this new solution which fixed the breakpoints, and opening the project from the Rider welcome screen now shows the solution directory as a relative path (~/Users/...)
Another solution for you (or other people who come across this):
When you have "COMPlus_EnableDiagnostics": "0" in your configuration or launchSettings you won't be able to hit breakpoints either.
Cleaning and rebuilding the solution, and then removing and readding the breakpoint worked for me!
None of these solutions worked. Solutions of clearing caches through the Rider interface and stuff like that, none of them worked. None of them.
The problem: a previously working referenced project of custom code (not some external library or nuget package) broke the breakpoints. Breakpoints outside the package worked, but not in the referenced project. I was getting that "stop sign" symbol in which it couldn't resolve a method.
The only thing that worked was to completely erase all instances, and previous instances, of Rider from Application Support and Caches on my mac. After following the instructions to completely erase Rider on their website, and then reinstalled it, I was able to get the breakpoints working again. Sorry, but for some of you this may be the only thing you can do.
If you're using .NET core and IIS, make sure the Application pool has 'No Managed Code' under '.NET CLR Version' in the Basic Settings:
I had this problem too and the cause was a spurious <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> in the csproj. Removing this setting restored debugging capabilities.
In my case the breakpoint not being hit when debugging a project with IIS Express.
The issue has been solved after running Rider as administrator
Thanks to #David smith's answer here:
Can JetBrains Rider work properly with IISExpress?
I'm running my .NET 4.0 (C#) project in debug mode after I start VS2013. It runs just fine.
The second time I start it from VS, I get the Dialog box that says "Error while trying to run project: Unable to start program C:\path\to\file.exe"
The process is still alive in the Taskmanager when I dismiss the dialog box.
From Windows Explorer, I can run the program just fine. And after closing it, the process is gone too from the Task Manager.
A rebuild doesn't help.
Is this a common problem with a known solution?
I had an issue similar to this and I had to clear the component cache instruction can be found Here.
Hope this helps.
For my case, it cause by Platform target, you could force choose it to x86 or x64 which your project is:
Each Project's Properties > Build > Platform target
As I pointed out also here, the only solution that worked for me was to disable the ConEmu integration:
ConEmu → Settings → Integration → Default term → disable Force ConEmu as default terminal for console applications
Some users reported that it was enough for them to disable the Aggressive mode in that same settings tab; that wasn't the case for me though.
The topic is old, but this might help someone else.
So in my case I made a file in Visual Studio with .cp extension (accidentally deleted the last 'p') this made visual studio just "include" the the file and not mark it as a compilation unit, thus not compiling it, I looked the *.vcxproj file in a text editor and found out about this, so if you open the project file in a notepad or something just find your file at the bottom usually and change from <Item .../> to <ClCompile .../>
I was getting similar errors. I just had to restart visual studio. Sometime couple times a day.
I had a similar error and resolved it by cleaning the solution. Right-click the solution name in Solution Explorer and choose Clean Solution.
I found a solution here:
Please check "Use Managed Compatibility Mode" under Tools|->Options->Debugging->General.
I'm Brazilian, I don't speak English very well. I did this translation on google translator.
I know the topic is old, but it can still help someone.
I had this same problem in the following situation, I have a dual boot computer (linux debian 11 and windows 10). Inside debian, on my NTFS D disk, I created a folder to perform programming tests. After accessing that same folder with windows, I created a new project in visual studio inside that same folder that I had created in linux. The creation of the project went without problems, however when I tried to run the project (F5), I received the same error from this topic. I tried all the solutions I found on the internet, and nothing worked. I gave all permissions to my admin user and it still didn't work. Then I realized that even going straight to the folder where the application's executable was and clicking directly on it, I still received the access denied error message. So, I took the project out of the folder I had created in linux, and it worked. So, what I could conclude, is that because the folder where my project was was created in linux, for some reason, my windows didn't trust this folder, so it didn't allow running executables from inside that folder, even this one executable having been created by visual studio from within windows.
Just simply create a folder name as "projects" in c drive and copy paste the newly created project in it. Run the project by doing clean & Build or Rebuild method . It will work
open the folder which contains the solution in visual studio.
again, open your *.sln file by double clicking it inside the solution explore once opened try running the solution or rebuild the solution. once rebuild gets completed, it will open without error from next time.
My way of solving the error : error while trying to load project : Unable to start program and c:\Path\to\file.exe was simply by
First restart Visual Studio
Click the build icon
Select the rebuild option
Run the Program or Debug the Program
This was a weird one. Going to put what happened to me here because it might happen to someone else. Everything was fine with the app until suddenly after some fairly insignificant code changes I suddenly started getting this error. Visual Studio was compiling the executable just fine. But, the moment I tried to run it (either from Visual Studio or directly) the executable file would be automatically deleted right out of the Debug folder. Super odd--never seen anything like it. I began to get suspicious that perhaps an anti-virus or the OS was somehow identifying a checksum or some signature in the executable as "dangerous". Or perhaps some obscure compilation bug was corrupting the executable. So on a hunch I made another innocuous change (added a couple of lines of code to color code some text in a rich text box) and the problem went away.
Just recently, my Visual Studio 2010 stopped displaying IntelliSense suggestions automatically while I am typing. I can still press ctrl+space to get it to work, but it doesn't automatically show a list of suggestions like it used to. I have already tried disabling all my extensions, restarting VS and the computer, and I have checked all the appropriate settings (Options -> Text Editor -> C# -> IntelliSense) to make sure that it is set to offer suggestions after a character is typed.
Has anyone seen this behavior before? Does anyone have any other suggestions for how I can get IntelliSense to go back to the way things were before? If not, I might just have to do a fresh reinstall of VS...
In prose, in case you can't see the above image:
Open Tools > Options > Text Editor. If you're only having this issue with one language, find that language; if it's for everything, click "All Languages". Right at the top, there'll be a few options labeled "Auto list members", "Hide advanced members", and "Parameter information". Make sure all of those are enabled (though the second may be disabled; if so, ignore it).
I have found that at times even verifying the settings under Options --> Statement Completion (the answer above) doesn't work. In this case, saving and restarting Visual Studio will re-enable Intellisense.
Finally, this link has a list of other ways to troubleshoot Intellisense, broken down by language (for more specific errors).
http://msdn.microsoft.com/en-us/library/vstudio/ecfczya1(v=vs.100).aspx
I'll start off my noting that this hasn't happened since I upgraded my RAM. I was at 4GB and would often have multiple instances of VS open along with SSMS. I have since gone to 8GB and then 16GB.
Here's the steps I go through when I lose intellisense.
If only one file/window appears to be affected, close/reopen that file. If that doesn't work, try below.
In Visual Studio:
Click Tools->Options->Text Editor->All Languages->General
Uncheck "Auto list members"
Uncheck "Parameter information"
Check "Auto list members" (yes, the one you just unchecked)
Check "Parameter information" (again, the one you just unchecked)
Click OK
If this doesn't work, here's a few more steps to try:
Close all VS documents and reopen
If still not working, close/reopen solution
If still not working, restart VS.
For C++ projects:
MSDN has a few things to try: MSDN suggestions
The corrupt .ncb file seems most likely.
From MSDN:
Close the solution.
Delete the .ncb file.
Reopen the solution. (This creates a new .ncb file.)
Notes:
This issue does not appear to be specific to C# as C++ and VB users
report the same issue
Tested in VS 2013/2015
Steps to fix are:
Tools
Import and Export Settings
Reset all settings
Back up your config
Select your environment settings and finish
I also faced the same issue but in VS2013.
I did the below way to fix, It was worked fine.
Close all the opened Visual studio instance.
Then, go to "Developer command prompt" from visual studio tools,
Type it as devenv.exe /resetuserdata
Restart the machine, Open the Visual studio then It will ask you to choose the development settings from initial onwards, thereafter open any solution/project. You'll be amazed.
Hope, it might helps you :)
Deleted the .suo file in solution folder to solve the problem.
Sometimes i've found Intellisense to be slow. Hit the . and wait for a minute and see if it appears after a delay. If so, then I believe there may be a cache that can be deleted to get it to rescan.
I hit this today after the following sequence:
Added a new class to my project.
Closed Visual Studio, but accidentally selected No when it asked if I wanted to save changes.
Reopened Visual Studio, and found that it reopened the new file automatically but without my previous changes (as expected). However, IntelliSense was no longer working in the new file.
The problem was in addition to not saving changes to the new file, it didn't save changes to the project, so after reopening Visual Studio the file was not part of the project. The Show All Files command in Solution Explorer, or Add → Existing Item..., resolved the problem.
I had the file excluded from the project so i was not able to debug and have intellisense on that file.
Including the file back into the project solved my problem! :)
A new cause for this in the .net core era is having a project loaded for an unsupported .net core version. For instance if you loaded a project from GitHub that was set to use:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
But you only have 2.1 installed or find yourself using Visual Studio 2017 then the compiler wont be able to find the SDK code and thus provide intellisense.
The solution in that case might be to right click on your project and select Edit MyProject.csproj from the context menu and change the target framework as necessary:
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
This assumes whatever project you loaded can actually be run under a lesser target framework.
I simply closed all pages of visual studio and reopened ..it worked.
Deleting the .vs folder in the solution solved my issue. You have to exit from Visual Studio and then delete the .vs folder and start Visual Studio again.
Closed all my VS windows
Started the Visual Studio Installer and clicked 'Modify'.
Under 'Individual components' > 'Code Tools' > Deselected NuGet package manager and re-selected it.
After modifying and restarting VS, IntelliSense was working correctly again.
Found my answer on https://developercommunity.visualstudio.com/content/problem/130597/unity-intellisense-not-working-after-creating-new-1.html
[Tools -> Options -> Text Editor -> All Languages -> CodeLens]
Check if check box "Enable CodeLens" is checked
I have just come to about this problem while installing one of the extensions and its file was deleted by my anti virus so I just disabled my anti virus and reinstalled visual studio. Suggestions are working properly without any changes made after installation.
At the bottommost right look at the blue line where Ln, Col, Spaces, UTF, CRLF,..... here the language is specified.
Check that your language and the language specified there are the same.
In my case, it was Django Python while I was trying to use HTML.
This may be due to the solution configuration changed to Release Mode instead of debug. Right click on solution -> Properties -> Configuration Properties -> Set Configuration To Debug if it is in Release.
When I try to publish my (WPF, C#) application, I get these errors:
Cannot publish because a project failed to build.
Could not find file 'obj\x86\Debug\MyAPP.exe'
I get these errors no matter where from I publish: publish wizard, build menu or right click on project - publish.
First it was working ok, but I did the following:
I changed the date om my computer to 10/10/2013, I was trying something else. I forgot this and I click build. Then I set the proper date on computer. After that I get these errors.
Also every time I click run Visual Studio builds project whether there are changes in project.
I also noticed that when I set the date after 10/10/2013 it works ok.
I am guessing that I am looking for some settings in my project where this date of build is set.
I tried build, rebuild, clean solution.
This is a problem with Visual Studio that can occur when you have add-ins installed. Instead of using the Publish button in the Publish tab, use Build/Publish from the menu on the top of Visual Studio.
If you use the Publish button, it runs through the add-ins before doing the build (or something like that). If you use Build from the menu instead, it goes straight to msbuild and ignores any add-ins you have installed.
If you have DevExpress installed and are still having problems, check out this article:
http://www.devexpress.com/Support/Center/p/Q260132.aspx
With the date back to normal, close VS and try deleting your *.suo files next to the *.sln files and then reopen the solution
I'm not sure exactly how your development machine can get fouled up this way, but this started happening for several developers in our group too.
After researching it, it appears that the built in build/publish script that Visual Studio (2010 in our case) uses has a flaw in the order that it does things. Most importantly it runs a cleanup on the OBJ directory deleting the target EXE file before the publish step can grab it.
The solution
This is somewhat of a hacky workaround, but it solved the problem for me.
The fix is to copy the file back to the /obj/ folder from the /bin/ folder right before the publish step. Unfortunately there is no way that I know to specify a BeforePublish event through the IDE, so you will have to edit the .vbproj file in a text editor.
Add the following section just before the final </project> tag.
<Target Name="BeforePublish">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(IntermediateOutputPath)" />
</Target>
I solved my problem. The problem was the "Modified" time of some files. I used the program Timestamp to fix it.
As I said in my question, the problem was that I build the solution and the date was in the future. Because of that, every time I pressed F5 Visual Studio was building the whole solution again and Publish ClickOnce wasn't working.
If nothing else works, try this :
Set your date to the proper date.
With VS closed, delete all the bin and obj folders of your solution.
Create a new empty solution.
Add your existing projects to the solution.
Add back the needed references.
Rebuild to make sure you didn't miss anything.
Publish.
If you want, you can also just try step 1, 2, 6, 7 before, if you don't feel like making a new solution.
Just create a new ClickOnce manifest certificate, and it will work again.
I have sometimes had problems with an ASP.NET project publishing, because the publish wizard couldn't delete files in the directory it was trying to publish the files to.
Try clearing out those file manually before publishing. Also check the output window; it will sometimes give you some hints as to why the publish failed.
I just ran into the problem today. In my particular case, it was caused by Microsoft Windows Update, Microsoft Security Advisory 2661254 (concerning minimum certificate key length).
I uninstalled that update and publish began working as it always had. This is only a temporary work around and means you should probably regenerate your keys/certificates.
I've had this error when I'd been swapping git branches. A Rebuild All fixed this for me.
In my case, the problem arise when I added the following section in .csproj File:
<Target Name="AfterBuild">
</Target>
Closing and Opening Visual Studio worked for me.