I'm using Visual Studio Community Edition 2013. When I select Run All in the Test Explorer, the latest changes I have done to the test code will not be included. I have to remember to right-click on my tests project and choose Build each time, and it is annoying.
How can I fix so that the build is always done automatically, like it is when running an ordinary project?
Solved it: for some reason the active solution configuration in the Configuration Manager (reached by right-clicking the solution in the Solution explorer) was set to not build all projects. I don't know how this came to be, but now it works at least.
Related
For the software at work we have multiple projects in a solution. Most of the project we can just build the solution and then publish artifacts of the web project that we need. API and Auth projects are slightly different though. Our currently deployment process is manual and for the API (STARS.API.csproj) and Auth (STARS.Auth.csproj) project when would go into Visual Studio 2017 and right click the project and click publish, select a profile and then publish. Once that is done we take the Publish Output and drop those files on our server.
We are trying to move to a automated process through TFS and I am using the Visual Studio Build task in a build definition. However when I try to run this through TFS, an error saying that the publish profile cannot be found:
Validating PublishProfile(TFSProfile.pubxml) settings. C:\Program
Files (x86)\Microsoft Visual
Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets(4368,5):
Error : The value for PublishProfile is set to 'TFSProfile.pubxml',
expected to find the file at
'C:\agent_work\4\s\STARS\Source-dev\STARS.Web\Properties\PublishProfiles\TFSProfile.pubxml'
but it could not be found.
It is looking for publish profile in a different project folder.
Visual Studio Build Task:
I feel that I can approaching this completely wrong. I am just trying to replicate the process on publishing the project through Visual Studio 2017 manually.
Please let me know if you require more information.
I suggest you start using the pre-defined build variables. $(Build.SourcesDirectory) will map to C:\agent_work\4\s, and from there you can create a full path to the TFSProfile.pubxml, where ever it might be in your source tree. Use this full path in the MB Build Arguments, PublishProfile property, e.g.
/p:PublishProfile=$(Build.SourcesDirectory)\STARS\Source-dev\STARS-API\TFSProfile.pubxml
Another problem you may have is that in the Solution field you are not specifying a solution (.sln) but a project (.csproj). I suspect that MSBuild is picking up the solution associated with that csproj, and building the whole solution, which is why it is looking for a publish profile in STARS.Web. Have you created a publish profile for STARS.API?
My .NET framework 4.6.1 console application works fine on my friends computer but after cloning the repository and running it on mine it seems to not want to compile. Everything still works the same as it did when I tried debugging and noticed it wasn't working.
Any other application I try compiles fine, this is a bug with this project only.
Extra details, as I was told I didn't example enough?
I've tried compiling it pretty much every way, clicking the Start button with the green triangle, F5, CTRL+F5 and none compile the code. It runs just as it would if it worked, it just doesn't apply changes I've made in the source code when debugging. I'm using Visual Studio 2015.
In Visual Studio, go to Build > Configuration Manager
With Active solution configuration set to Debug, make sure that your console application project has the Build checkbox ticked. This is usually ticked by default.
Otherwise you can explicitly build your project by selecting Build > Build ProjectName (Shift+F6) or right-clicking your project in the solution explorer and selecting Build from the context menu.
When I build a C# program (this has been going on for several different solutions/projects I have been working on) in Visual Studio 2017, the new, updated code will build and run in debug mode (and run correctly).
However, the application that Visual Studio has been outputting when I build/debug them has been remaining with the original, first version of code that I saved. When I choose the options to rebuild, it will update the time stamp on the application and .pdb files, but the application will perform the way it did in earlier code versions, not the most recent code version that was running problem when I ran debug mode immediately after pressing Ctrl + F5.
These are C# Console Apps with the .NET Framework 4.6.1, if that makes any difference. I checked the output folder, and it is indeed the desired folder and the one I have been looking in... so why is the time stamp updating on the application (.exe file) that it outputs, but not the code itself? What am I missing?
When I run into strange things like this in Visual Studio, the first thing that usually works is to clean the project and rebuild. If that doesn't work, I'll close Visual Studio, re-launch, then clean and rebuild again. If that doesn't work, I would start looking into any extensions you have installed that might be getting in the way of your build process.
Further, you can look into logging the extensions activity to help troubleshoot if there are issue there. See the following article:
https://blogs.msdn.microsoft.com/visualstudio/2010/02/24/troubleshooting-extensions-with-the-activity-log/
You may have already tried this, but since it wasn't mentioned I thought I'd provide it for others in a similar situation.
Two possible reasons:
(1) Your project was not recompiled during debugging. Please enable Edit and Continue under TOOLS->Options->Debugging.
(2) Visual Studio has a concept of incremental build. If you have a solution with two or much more projects and if you change source code in only one of the two projects, the "Build" command will compile only the modified project. But the "Rebuild" command, on the other hand, it will recompile all projects in this solution.
When trying to run Build / Rebuild in Visual Studio on a solution, nothing happens.
I can run the build from the command prompt using MSbuild.exe, and this gives me the output i would expect (Build succeeded) - But when trying to run it from visual studio, nothing happens. Theres no debug output or build output either.
The project is a MVC project, with some references to other projects.
I can create a new MVC project, and it runs just fine!
Any idea what might trigger this behavior?
Using Visual Studio 2015.
I Have tried the following:
Restarting VS
Comparing the solution file to a new solution file
Triggering build manually from MSBuild (OK)
Switching Debug / Release configuration
Building projects individually
Updated NuGet
Build Configuration is OK (Everything checked for Build)
That beeing said, the solution is inside a git repository, and the other person working on this project has entered at a later stage with Visual Studio 2013 - But i dont know if this has anything to do with the issue.
Go to your configuration Manager and make sure build checkbox is selected for your project.
other thing you can try is:
Go to tools > Options>> A window will pop up> Under Project and Solutions > select Build and Run
Make sure Before building is set to Save all changes
So what seemed to happen was that there was some kind of dependency on a separate git repository (bootstrap), in our private repo that i hadnt been getting access too - so instead of giving me an error about it it just silently failed.
Adding access to the repository to my account, suddenly made the project run again.
Try this:
Go to Tools -> Options -> Projects and Solutions -> Web Package Management
Under that UNCHECK option "$(VSINSTALLDIR)\Web\External".
After UNCHECKING the "$(VSINSTALLDIR)\Web\External" option, Restart Visual Studio and try to rebuild project.
Check whether any NuGet packages are missing, that was the problem with me. Go to
Tools -> NuGet Package Manager -> Package Manager Console
If any packages are missing, Visual Studio will show you a message and a "Restore" button to fix the problem. After that the application should build.
I opened my WinRT (I'm using MVVMLight) project in Visual Studio 2013 this morning, and found out that all kind of types even system ones are not recognized saying Cannot resolve symbol 'bool' for example, note that the solution builds, executes and works all fine !
C# :
Even XAML :
I tried many things, closed and reopened the solution, cleared Resharper caches, I even restarted Visual Studio and the PC, but still the same problem, any solution to this problem ?
Update 1 : I tried to Suspend/Resume Resharper from Tools>Options and even delete files from AppData\Local\JetBrains\ReSharper\v8.0\SolutionCaches, and now Visual Studio causes errors too :
Update 2 : I uninstalled/re-installed visual studio, and I still have the same problems
If you have any Xamarin extensions for Visual Studio installed, it is a root of the problem. There are some compatibility problems.
As a possible workaround, you may try a workaround, mentioned in this ticket:
Select 'true' for 'Use msbuild to obtain project references' in
Project Properties (Click on project name in Solution Explorer | Hit
F4) for each project in the solution.
At least, it works for me.
If you can build the solution, but ReSharper marks your code in red - you can write the request here and you will likely get a help.
If you can't build your project then it is not ReSharper's problem. Then we need to find out why your build is broken.
It seems that your project to assembly references are broken.
To understand what's happening here with references during the build, go to Tools -> Options -> Projects and Solutions -> Build/Debug and set the verbosity to diagnostic. Then try to build your project and investigate the output windows in VS (or you can use MSBuild.exe from the command line instead). What you need to find in this large text block is "Resolve Assembly references" or "Expand SDK references" task. These tasks should obtain the valid paths to the assemblies your project depends on. Later on csc.exe should be executed with all these paths as parameters.
You can check whether the paths are correct, do they indicate to the existing binaries or not.
You can also create a new WinRT project template and check if it can build. If it cannot even for the clean project template then it is obviously a system problem, I suppose your platform sdk's are corrupted.
Hope this will help.