I am trying to set up a new TeamCity build job and am facing a build issue.
The build failed because of missing references within ResolveProjectReferences step.
For instance :
JSonTools\JSonHelper.cs(21, 7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Prior to the build step, 2 restore nuget steps are set up and both ran successfully (one for sdk like project and the second for previous version, in this order)
When I run my solution on the agent and restore nuget packages through VS it is working fine (and TC job will run successfully if made on the same agent)
I noticed the dlls pulled during the restore nuget steps are in the path of my sln, while it seems to be require on others path.
Several VCS are set for this job and from what i can see/understand, the failing projects seem to require the dll to be in their own path under the packages folder.
\this
\is
\my
\path
Project1.csproj
packages\ (<- contains all the Dlls)
\folder1
\Project2.csproj
\Project3.csproj
\packages\ (I have the feeling some Dlls should be here but the folder doesn't exist)
\folder2
\Project4.csproj
\packages\ (same as previously)
Did I missed something ?
Any help would be appreciated.
Thanks,
Cervelle
Related
I am new to .net/C#. I am trying to build a project but getting a lot of missing reference error.
When I am trying to install the packages like mentioned in example, I am getting error that it already exists in the project.
PM> Install-Package Microsoft.AspNet.WebApi.Core
Package 'Microsoft.AspNet.WebApi.Core.5.2.7' already exists in project 'XXXXXXystemApi'
Time Elapsed: 00:00:16.0349189
Also, as in below screenshot, I see that there are few references which have a little warning signs which might be pointing towards what is wrong with my setup.
The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
I tried to Add references to the project but I am not seeing any entry for System.Web.Http under add reference dialog.
How do I fix all this ?
Try running
dotnet restore
in the Package Manager Console
Also, unloading and reloading the project has worked for me before
(Right-click on the project name in the Solution explorer to unload and reload)
Here is what finally solved my problem.
use NuGet and downgrade a version of library you are having issue with ; then re-install the right version. Accept Licenses (which is probably what was needed). Important: close and reopen visual studio.
Reference link : solution ref
I am running into the weird issue that the script component of an SSIS package deployed as part of an ISPAC file fails if the project deployment is done in an automated fashion - from C# or using PowerShell, that is. Deploying the exact same project using the Integration Services Deployment Wizzard in Visual Studio does not raise any erros when executing the package on the server.
However, I am getting various errors about things missing in the system namespace when executing the package that has been deployed with C# (using Microsoft.SqlServer.Management.IntegrationServices) such as:
DFT Load STG_ETL_TEST_STAGING_CDC:Error: CS0234 - The type or
namespace name 'ComponentModel' does not exist in the namespace
'System' (are you missing an assembly reference?),
Properties\Resources.Designer.cs, 59, 25
DFT Load STG_ETL_TEST_STAGING_CDC:Error: CS0234 - The type or
namespace name 'CodeDom' does not exist in the namespace 'System' (are
you missing an assembly reference?), Properties\Resources.Designer.cs,
25, 21
I exported the deployed packages and compared their file sizes. I noticed that the ISPAC of the manually deployed project is slightly bigger than the one deployed programmatically. What is the Deployment Wizzard doing to the project that isn't happening during automated deployment?
To exclude that it has something to do with my C# code, I also tried the following PowerShell script from the Microsoft docs. However, it does use the same assembly as I use in my code (Microsoft.SqlServer.Management.IntegrationServices) and the deployed package has the same issues.
I should have mentioned that the project was generated with Biml. Turned out the issue was not related to the binaries but the ISPAC file created by the Biml compiler. Building the project again with VS (using devenv.com theproject.dtproj -build) solved the issue for me and allowed for programmatic deployment of the project.
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'LearningModelSession' could
not be found (are you missing a using directive or an assembly
reference?) MNIST_Demo C:\Users\ansifmx\Downloads\Windows-Machine-Learning-master
(5)\Windows-Machine-Learning-master\Samples\MNIST\UWP\cs\mnist.cs
25 Active
similar error with all namespace, references in windows.machinelearning.ai
https://github.com/Microsoft/Windows-Machine-Learning
tried all three demos provided...none worked
please advice new here
Tried everything on this link https://learn.microsoft.com/en-us/visualstudio/ide/troubleshooting-broken-references?view=vs-2015
Tried referring windows.ai.machinelearing.preview
Updated all reference nuggets
Reinstalled references
nuggets manager both the check points are slected are on allow nuggets to download missing plugins,
6.moved to repos
Most likely the referenced Nuget packges are not getting restored.
Verify the settings at Tools >> NuGet Package Manage >> Package Manager Settings and make sure that it is set to download any missing package during build.
The exact setting may differ slightly based on the VS version you are using.
After updating windows to 1809 build 17763 with the latest SDK 17763. I was able to run the demo. I hope this helps.
I am working on setting a project to use bamboo for CI testing, but have hit a hitch when attempting to compile unit tests. We are using the .NET framework 4.5 and NUnit v2.6.3.13283. When I am in bamboo, I have set up the specific job to check out the source code when a new commit is pushed, and then use MSBuild to build the code. Unfortunately, when it reaches this second step, it decides that it no longer understands what NUnit is.
I have the nunit.framework.dll in the same directory (bin\Debug) as the class .dll, so I'm definitely confused as to how I should go about having MSBuild work out building the NUnit tests.
Any help would be appreciated.
EDIT: Error log for those not faint of heart.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig
/nowarn:1701,1702 /nostdlib+ /platform:AnyCPU /errorreport:prompt
/warn:4 /define:DEBUG;TRACE
/reference:c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll
/reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll
/reference:"C:\build-dir\UCL-UNL-JOB1\Unit Class
Library\bin\Debug\Unit Class Library.dll" /debug+ /debug:full
/filealign:512 /optimize-
/out:obj\Debug\UnitClassLibraryNUnitTests.dll /target:library
AngleNUnitTests.cs
"C:\Users\Bamboo\AppData\Local\Temp.NETFramework,Version=v4.5.AssemblyAttributes.cs"
AngleNUnitTests.cs(5,7): error CS0246: The type or namespace name
'NUnit' could not be found (are you missing a using directive or an
assembly reference?)
[C:\build-dir\UCL-UNL-JOB1\UnitClassLibraryNUnitTests\UnitClassLibraryNUnitTests.csproj]
AngleNUnitTests.cs(12,10): error CS0246: The type or namespace name
'Test' could not be found (are you missing a using directive or an
assembly reference?)
[C:\build-dir\UCL-UNL-JOB1\UnitClassLibraryNUnitTests\UnitClassLibraryNUnitTests.csproj]
etc.
You need to use a previous task to MSBuild one (Maybe you could consider to use the VisualStudio Task it works like a charm).
This previous task is a Command Task, it will update the Dlls related to the NuGet Package, in order to achieve it:
Create a New Executable on Bamboo, pointing to the nuget.exe file (if you don't have it you could download from https://www.nuget.org/
Create a New Command Task with the executable your created on the previous step.
On the Argument field: "restore YourSolution.sln"
In my approach I am using a VisualStudio task and after this one a MSTest Runner task.
When using Nuget with a source code repository, you have a couple of options.
1) check in your nuget executable to source code and create a bamboo command task that calls that location relative to the build directory, ${bamboo.build.working.directory}\tools\Nuget.exe.
2) Install the Nuget exe directly on the build server. Then you can create a new executable on Bamboo that you can reference in any task.
To create a new executable for use in tasks, use this - https://confluence.atlassian.com/display/BAMBOO/Defining+a+new+executable+capability
I guess you are using NuGet?
If so, you need to enable NuGet Package restore, because MSBuild does not know how to resolve these NuGet packages. This will create a .nuget directory in your solution which needs to be pushed the repository bamboo uses for the build.
Second problem I encountered when configuring the NUnit test runner with bamboo: the nunit-console.exe uses .NET Framework 3.5 which was not installed on my build server.
I have been trying to get my solution to build in a CI configuration using Visual Studio Online and the hosted build controller.
I have created a folder in the root of my workspace with the required NUnit binaries as per these guidelines.
I have also referred to these previous questions where users had issues trying to accomplish the same thing:
Visual Studio Online CI Nunit Tests not found during build
What else is needed to get the Hosted Build Controller to run my NUnit tests
I have the "NUnit Test adapter for VS2012 and VS2013" package installed in all of my test projects.
The error messages in my build log are like this:
Tracking_works_when.cs (35): The type or namespace name 'TestAttribute' could not be found (are you missing a using directive or an assembly reference?)
The type 'TestAttribute' is one of several missing ones, including 'Test', 'TestFixture' and 'TestFixtureAttribute'.
There is also the following warning:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1605): Could not resolve this reference. Could not locate the assembly "nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
The same warning is repeated for "nunit.core.interfaces" and "nunit.core".
Question:
What am I missing? Why are my NUnit binaries not being identified within the hosted build environment and my tests run automatically?