可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I have a Visual Studio 2010 solution with a few projects. I can successfully build with Build -> Build Solution or Build -> Build MyCompany.MyProduct.MyProject. After building I press CTRL+F5 and successfully run the start up project. This works as expected.
After I change a source file, save it and then again build (with either Build -> Build Solution or Build -> Build MyCompany.MyProduct.MyProject) it builds successfully. I am still able to press CTRL+F5 and run the startup project. This again works as expected.
The problem is in the following scenario:
After I change a source file, save it and directly press CTRL+F5 then Visual Studio 2010 says BUILD FAILED and there are no errors. And it doesn't start my startup project (of course).
Am I missing something?
回答1:
Close Visual Studio, delete the .suo
file for your solution. It's a 'hidden file' in Windows and contains user preferences, but it can also do nasty things.
回答2:
Seems a bit late, but what worked for me was to check my Output window.
I had a reference to a Function that didn't exist yet. I don't know why it never came up in the Error List, but the Output window told me exactly where the problem was.
回答3:
Try repeating the same steps by changing the location where you compile/run. Make sure your new location has less folders to traverse when compared to your old location. A lengthy path to the source code had resulted in a similar issue to me and I overcame it by choosing a shorter path.
回答4:
I closed my visual studio.
Deleted every bin folder. (I had a weird permission error, so I deleted the files and back track deleted the folders including bin).
Reopened visual studio. Performed build or rebuild and everything was working again.
回答5:
Check your project physical path , If is to long , Copy project to some root directory folder with very short name.
And try to build your project.
回答6:
I had this problem and had one warning but couldn't find any errors. Eventually I copied the build command from the output window into a command window and ran it manually - it spat out four errors after the warning. I have no idea why this worked.
The command required should be labelled "CoreCompile" and look something like this: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;SILVERLIGHT;WINDOWS_PHONE /errorendlocation /preferreduilang:en-US /highentropyva- /reference:"C:\Dropbox\code
If you don't see it, try changing your build output settings under Tools->Options->Projects and Solutions->Build and Run, set "MSBuild project build output verbosity" to Normal or higher.
回答7:
In case some other folks are experiencing this issue (I had tried deleting the SUO file first but this didn't work for me):
I solved it by creating a blank new Project in my solution and importing all source files into the new project. Likely the problem sat in project file.
回答8:
I had the same problem, solved by the following step
go to Tool->option->projects and Solution->General, make sure to check the box "Always show Error List if build finishes with errors", in this case, visual studio will show the error list.
回答9:
In my case I did not see a Code Contracts bug in the output window:
CodeContracts: xxx: Unhandled Exception: System.IO.FileNotFoundException:
Could not load file or assembly 'System.Data.SqlServerCe, Version=3.5.1.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
The system cannot find the file specified.
I solved it by disabling Cache Results in the Code Contracts windows for that project, as suggested in this answer.
回答10:
I was working on a web site project that referenced a library project (in the same solution) when I ran into this issue. Build failed while the editor was highlighting syntax and navigating to the source. Very frustrating.
None of the other answers worked for me; I thought this issue might be related as I recently used DBML for the first time on this machine. Still not entirely sure it wasn't a contributing factor.
After cleaning solution, temp files, restarting VS, etc., I ended up excluding the 2 offending files, which allowed the solution to build successfully, then when I included them again everything built correctly.
p.s. I later discovered an error in the website's masterpage codebehind (referencing an enum value that had been removed), which was not being displayed as an error. I've had errors in masterpage codebehind cause (apparently) unrelated problems before; I try to remember to check there when a simple solution doesn't present itself.
回答11:
My issue arose from converting a functional vs2008 project to vs2010. All other projects in the solution came across fine, but this one would build the MIDL portion, then stop and fail. Detailed build setting revealed nothing, so finally I created a whole new project with all files the same. This worked. Then I compared the settings, and finally after changing the various parts to match, I discovered that the converted project had MIDL->General -> "MkTypeLib Compatible" set to blank. This was a valid setting in vs2008 apparently, but in vs2010, it apparently must be set to Yes or No (or inherit).
This has fixed my issue.
回答12:
if your solution contains too many projects ,
build projects individually,
Check which project is failing
for that project check the references of that project , if on any reference if their is yellow color mark, then delete that reference , and add that again , then build and check,
this will work
or
check in output window , each line , in some line it may be showing , dependency is their , but didnt found it , that is the problem causing
this may be due to file corruption
回答13:
Has this issue when dealing with Sharepoint 2013 Workflows in VS 2013. To solve it did the following:
- Unload worklfows ( the buggy one) project.
- Delete .csproj.user file
Opened .csproj file in the notepad and delete the following lines:
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '11.0'">11.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
After RELOADING project into solution, the VS added exactly the same lines AGAIN, but no LoaderException issues now.
回答14:
I had this issue today as well... after changing the verbosity of build to diagnostic like @Jac suggested, i discovered that the problem relies in one my resx files. Apparently, one image was corupted or was too big, i deleted it and it worked!
回答15:
I faced that problem two days ago. I checked on Windows output and I founded there was a missing reference to VBIDE: Cannot find wrapper assembly for type library VBIDE. I showed all files on the solution explorer, expanded references and I found there was a reference to that assembly. I do not know how that reference came into my project and I was sure I did not need it. I just removed it and everything was fixed.
回答16:
Another thing to check is that if any of your source files are open it will not be able to build. I had to restart my computer.
回答17:
Some times if the Directory path is more than 248 chars it will fail the Solution.
Make sure complete path is less than that.I have faced the same issue than i made short and it did worked for me.
Regards
Venkateshwarlu,
MSBI Developer,
Hyderabad.