TeamCity - Missing 'Microsoft.Web.Infrastructure' - c#

I've been browsing around StackOverflow exploring possible solutions to my issue. For some reason TeamCity is unable to find 'Microsoft.Web.Infrastructure' but I have installed all the required .Net packages. However, I've ran all the tests locally and building the project within Visual Studio returns a successful build.
This is the error which I am experiencing:
App_Start\NinjectWebCommon.cs(9, 40): error CS0234: The type or namespace name 'DynamicModuleHelper' does not exist in the namespace 'Microsoft.Web.Infrastructure' (are you missing an assembly reference?)
Solutions I have tried
Within Visual Studio I was instructed by one StackOverflow thread to set the reference 'Microsoft.Web.Infrastructure' option 'Copy Local' to true. This returned the same result of the error above.
I've deleted all references of 'Microsoft.Web.Infrastructure' and performed a fresh install of this package, I'd had also reinstalled Ninject as well. I didn't specify a particular version. Again, building locally was successful remotely not so much - same error occurred.
Has anyone encountered such issue before? I had also done a fresh clone of the GIT Repository, restored all the NuGet Packages (Which TeamCity does as well) and it built completely fine.

After asking this question I'd continued my investigation. While my continuous integration server is running multiple windows virtual machines, and since TeamCity load balances the builds across these virtual machines some of their configurations were out of sync with the rest. Some of the team code purely in C++, so the version of Microsoft Visual Studio which was installed (Visual Studio Professional 2013) was the incorrect version for my C# project. After attempting to open the project with Visual Studio on one of the selected VM's, I found that Visual Studio didn't understand the csproj file extension.
I installed Visual Studio 2013 Ultimate - this is version I use on my workstation - and thankfully it complied. sometimes within my project, when I request a build it would use older files as TeamCity would cache the files locally. I found setting the to 'clean and re-download' within the VCS options also remedied this issue.

Related

Can't access namespaces from Nuget Package

I have an Identity Server 3 Project where I need to install a couple of custom Nuget Packages, that comes from a private Nuget Package repository in my company. This Nuget is installed and running in many other web projects so it is most likely not the problem.
When I install the package on Identity Server Project, logs say everything was fine and the package was successfully installed. It is listed on Project References. But when I try to access it anywhere on Identity Server Project, it just isn't accessible. I can't set up an using reference, neither call any methods by using it's full namespace (InstalledNuget.Services.Example). Visual Studio's intellisense returns "The type or namespace name does not exist in namespace 'company' (are you missing an assembly reference?)".
While investigating the issue, I found out that it is listed on Project References, but not on Object Browser.
I tried:
reinstalling the package;
restarting Visual Studio;
Deleting the packages folder and let the program restore then again;
I have been to several posts here and other websites but did not find a problem matches this one. Any hints?
The error was some visual bug on Visual Studio. I accidentally clicked on run, and it run successfully, with errors still on the screen. It ignored then completely.
Then I manually removed "bin" and "obj" folders and everything returned to normal.

Build and test with TeamCity and Fakes Framework

We are running a TeamCity 8.1.4 buildserver with VS2013 installed on the machine.
I've recently introduced tests which rely on the Microsoft Fakes Framework. Because of this I had to add some references to the new Fake assemblies and the Microsoft.VisualStudio.TestTools.UnitTesting assembly.
This all runs fine on my local development machine.
Now, when I try to build the solution on the TeamCity server, the following errors are thrown:
SomeDirectory\Processors\ProcessorTests.cs(3, 27): error CS0234: The
type or namespace name 'Fakes' does not exist in the namespace
'SomeDirectory.Database' (are you missing an assembly reference?)
SomeDirectory\Processors\ProcessorTests.cs(7, 66): error CS0234: The
type or namespace name 'Fakes' does not exist in the namespace
'SomeDirectory.Service.Processor.Report.Processors' (are you missing
an assembly reference?)
SomeDirectory\Processors\ProcessorTests.cs(9, 17): error CS0234: The
type or namespace name 'QualityTools' does not exist in the namespace
'Microsoft' (are you missing an assembly reference?)
I somewhat understand the first two errors, because I haven't committed the Fake assemblies in SVN, therefore they can't be found. I also don't want to commit these files, because the build server should generate these by itself. The BuildAction of the fakes-files is set to Fakes.
My guess is the first two errors have their origin met at the third error. To my knowledge the QualityTools namespace resides in the Microsoft.VisualStudio.TestTools.UnitTesting assembly.
I've tried to fix this with several settings.
The original build step I had configured was:
Runner type = Visual Studio (sln)
Visual Studio = Microsoft Visual
Studio 2013
I've changed this to:
Runner type = MSBuild
MSBuild version = Microsoft Build Tools 2013
MSBuild ToolsVersion = 12.0
I've also tried the MSBuild version .NET 4.5 with ToolsVersion 4.0.
All of these settings result in the same errors.
As you can understand, the solution won't compile at the moment, so I can't tell for sure if the tests will run or not. I've already found a post on how to configure the test step with TeamCity, but that's the next step.
Anyone got an idea on how to fix these issues with TeamCity and VS2013?
Edit
I've already checked if the TestTools.UnitTesting assembly exists on the filesystem. This assembly is present, so this shouldn't be a problem
Edit 2
Oops, I've misread the third error message. I should have been looking for the Microsoft.QualityTools.Testing.Fakes assembly, because it says it can't resolve the QualityTools namespace. After checking the path Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies I can confirm the dll isn't present on the filesystem.
I've copied it manually to the buildserver and see what will happen next.
Edit 3
After having copied the Microsoft.QualityTools.Testing.Fakes assembly to the build server, the solution compiles like a charm. However, now I'm receiving the familiar
Failed to resolve profiler path from COR_PROFILER_PATH and
COR_PROFILER environment variables.
I've seen this before on a TFS2012 server. This meant it wasn't able to handle shims and we had to upgrade to TFS2013.
I just logged in on the buildserver and saw the VS2013 version is expired. That's perhaps the reason it doesn't work properly. The installed VS2012 installation is version 11.0.50727.1, so Update 3 is not installed. I'll discuss with my colleagues if this can be updated. Hopefully this will resolve the issues I'm facing with the fakes and shims.
Resolved
Apparently someone thought it was funny to install the VS2013 Professional on the buildserver. Therefore the fakes couldn't run, as it's a Premium feature. Installed the Premium version and everything works like a charm now.
Fakes wont run with MSTest you have to you VSTest.Console
Usually (for VS2012 in this case) it is located C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
There is also runner available on http://confluence.jetbrains.com/display/TW/VSTest.Console+Runner, but if this doesnt work, run the executable "by hand", here is reference for running vstest.console.exe http://msdn.microsoft.com/en-us/library/jj155796.aspx.
If you have VS2013 installed on agent machine (Pro edition contains fakes, express doesn't) it should compile fine. Have you tried clean checkout on your dev machine?

Upgrading build server to Visual Studio 2013 has broken deployment process

My build manager has been banging it's head on this for quite sometime.
We were using Visual Studio 2012 Professional with MSDeploy. Everything ran fine, we were able to do builds, Xml transforms, database deployments, web deployments, etc. to various environments.
We recently upgraded our build server to Visual Studio 2013 Professional and pretty much all hell has broken loose.
We get the following errors during our build process since upgrading:
Error Code: ERROR_EXCEPTION_WHILE_CREATING_OBJECT
More Information: Object of type 'manifest' and path 'C:\Builds\90\Code\Staging - Project\Binaries\Website Deployment\Project.Web.manifest' cannot be created. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT.
Error: One or more entries in the manifest 'sitemanifest' are not valid.
Error Code: FileOrFolderNotFound
More Information: Could not find file 'C:\Builds\90\Code\Staging - Project\Binaries\Website Deployment\Project.Web'. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#FileOrFolderNotFound.
Error count: 1.
We have done everything possible to fix this issue. We have tried everything to get this building again. Even updating the project .prj file itself to point back to older .targets v10.0 from v12.0.
When we do "change" targets, it give us this new error:
C:\Builds\90\Code\Staging - Project\Sources\Project.Web\Project.Web.csproj (3290): The "TransformXml" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework64\v4.0.30319" directory.
So it seems Visual Studio 2013 has modified something pretty significant in our environment to cause these errors during our Deployment process (the verbose log indicates that everything is building, just not deploying correctly).
Any help would be awesome!
I also recently upgraded to Visual Studio 2013 and found problems with deployment of a database project where the "Deploy" option didn't do anything and the publish didn't produce the differencing script I was expecting.
I installed the SQl Server Data Tools - Business Intelligence for VS 2013 and it resolved the problem for me. Perhaps it may help in your situation.

Visual Studio 2008 Version Issues

I currently have installed Visual Studio 2008, Version 9.0.30729.4462, and I am running into some fairly odd issues that I believe are all linked.
1. When building my solution, I get 5-10 of these output in the debug output:
Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5".
All of the .csproj files of the projects contain toolsversion="3.5".
2. When trying to access the Security tab in the project properties, I get the following error:
Visual Studio was unable to determine the Code Access Security (CAS) permissions that are applicable to your project. The most likely cause is that your project references a strongly-named assembly that defines custom permissions, but that is not properly installed in the global assembly cache (GAC). To correct this, try the following:
1. Ensure that any custom permissions defining assemblies referenced by your project have been properly installed to the GAC. If any of these assemblies have been rebuilt or have had their version numbers modified, you must install the new assemblies in the GAC.
2. Restart Visual Studio.
Looking for solutions on here indicate that this is a typically a toolsversion 4.0 problem; however, like I said, all of my projects have 3.5 set in the csproj files.
Where should I start troubleshooting?
Both of these problems were related to the toolsversion="4.0" issue. I have a lot of projects integrated into my solution, so I did a search for "toolsversion=" on my solution directory. It turns out a few of my .csproj project files were indeed set to 4.0. Once all of the projects were set to 3.5, the security tab came back, and I didn't receive any more errors when compiling.

Unable to set TestContext property

I have a visual studio 2008 Unit test and I'm getting the following runtime error:
Unable to set TestContext property for the class JMPS.PlannerSuite.DataServices.MyUnitTest. Error: System.ArgumentException: Object of type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext'
I have read that VS 2008 does not properly update the references to the UnitTestFramework when converting 2005 projects. My unit test was created in 2008 but it inherits from a base class built in VS 2005. Is this where my problem is coming from? Does my base class have to be rebuilt in 2008? I would rather not do this as it will affect other projects.
In other derived unit tests built in 2005, all that we needed to do was comment out the TestContext property in the derived unit test. I have tried this in the VS 2008 unit test with no luck. I have also tried to "new" the TestContext property which gives me a different runtime error.
Any ideas?
I had the same problem in Visual Studio 2012 when I upgraded an older project (i think 2005).
The Reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework needs to be removed by right clicking it in the Solution Explorer then removing it.
To add the right one:
Add New Reference
Extensions, find Microsoft.VisualStudio.QualityTools.UnitTestFramework, there are likely several
Mouse over to display the path, choose the one in ../IDE/PublicAssemblies
Clean
Rebuild
Rerun tests
I'm posting this here in the hopes that it helps someone unit testing a smart device project. I got a very similar error when I first tried to run a unit test for a method in a smart device project I was working on in Visual Studio 2008:
Error: System.ArgumentException: Object of type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext'
Googling the error returned results that suggested it was caused by upgrading a test project from Visual Studio 2005 format to 2008, and that the reference to the UnitTestFramework.dll was still for the old version (8.0) and required updating. This did not apply to me as I had not upgraded my test project from VS2005. So I continued searching.
After hours of searching for other causes for the error without success, I stumbled upon the following references in the smart device project:
Microsoft.WindowsMobile.dll
Microsoft.WindowsMobile.Status.dll
Visual Studio was obtaining these references from the following folder:
C:\Program Files\Windows Mobile 5.0 SDK R2\Managed Libraries
However, the smart device project's target platform was the Windows Mobile 6 Professional SDK. I didn't notice this before as I did not originally create the smart device project. So I removed the references to the two DLLs and readded them from the following folder:
C:\Program Files\Windows Mobile 6 SDK\Managed Libraries
After rebuilding the smart device project, running the test method succeeded.
I ran into the same issue. Turned out that one of my projects was referencing the 8.0 assemblies and the other was referencing 9.0. The solution compiled, but I got a runtime exception.

Categories

Resources