travis-ci cannot build .net project - c#

I just pushed a test project for travis to build, but it fails. Error:
ConsoleHelpersTests.cs(2,17): error CS0234: The type or namespace name
VisualStudio' does not exist in the namespaceMicrosoft'. Are you
missing an assembly reference?
my .travis.yml file:
language: csharp
solution: TravisDotNet.sln
Am I missing something?

Related

How do I resolve "The type or namespace 'System' could not be found" with UWP 6.2.10?

I'm trying to build a project using Microsoft.NETCore.UniversalWindowsPlatform version 6.2.10 and I get numerous build errors such as:
error CS0246: The type or namespace 'System' could not be found (are you missing a using directive or an assembly reference?)
error CS0400: The type or namespace name 'System' could not be found in the global namespace (are you missing an assembly reference?)
error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib'.
error CS0518: Predefined type 'System.Object' is not defined or imported
error CS0518: Predefined type 'System.Boolean' is not defined or imported
error CS0246: The type or namespace name 'AssemblyTitleAttribute' could not be found (are you missing a using directive or an assembly reference?)
Other developers on my team are able to build the project successfully using the exact same code.
If I downgrade the NuGet package Microsoft.NETCore.UniversalWindowsPlatform to version 6.2.9 without making any other changes, it builds fine.
I tested this by creating a brand new Blank App (Universal Windows) project in Visual Studio 2019, which uses version 6.2.9 of the NuGet package by default. I didn't make any changes to the template created by Visual Studio. This builds fine. Then I upgraded the NuGet package to version 6.2.10 without making any other changes. It fails with build errors similar to the errors above.
How do I resolve these errors?
I was eventually able to resolve this by clearing the NuGet cache, then removing and re-adding the NuGet package. Both steps were necessary to resolve the errors.
To clear the NuGet cache, click Tools → NuGet Package Manager → Package Manager Settings → NuGet Package Manager → General → Clear All NuGet Cache(s).

Mono compile error due to namespace name does not exists

I'm using mono on macOS and trying to compile this C# code: https://gist.github.com/bneg/bf8c05664324e3efeb1fb05902152a20
with following command:
mcs Program.cs
It produces following error:
Program.cs(4,14): error CS0234: The type or namespace name `Management' does not exist in the namespace `System'. Are you missing an assembly reference?
Program.cs(5,14): error CS0234: The type or namespace name `Management' does not exist in the namespace `System'. Are you missing an assembly reference?
I also tried it with following command:
mcs -pkg:dotnet Program.cs
I got this error:
Program.cs(17,25): error CS0234: The type or namespace name `Automation' does not exist in the namespace `System.Management'. Are you missing an assembly reference?
Program.cs(18,25): error CS0234: The type or namespace name `Automation' does not exist in the namespace `System.Management'. Are you missing an assembly reference?
What changes should be made in order to compile it?
I'm not sure if you can run powershell like that via mono on mac os.
As a minimum you would need to reference something like this:
https://www.nuget.org/packages/System.Management.Automation
But this is not guaranteed to be working if you do not have powershell installed. And since powershell on linux (sic!) can only run on .net core, chances are, you cannot get what you are trying to accomplish.

System.Diagnostics.Tracing Build Errors in Mono

I'm trying to build a project in Mono (v4.4.1) that makes use of the System.Diagnostics.Tracing dll but I continually run into build errors:
/usr/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->
Context/TplFrameworkListenerBase.cs(12,54): error CS0246: The type or namespace name `EventListener' could not be found. Are you missing an assembly reference?
Context/TplFrameworkListenerBase.cs(52,40): error CS0115: `FastTrack.Context.TplFrameworkListenerBase.OnEventSourceCreated(System.Diagnostics.Tracing.EventSource)' is marked as an override but no suitable method found to override
Context/TplFrameworkListenerBase.cs(114,55): error CS0246: The type or namespace name `EventWrittenEventArgs' could not be found. Are you missing an assembly reference?
Context/TplFrameworkListenerBase.cs(142,31): error CS0246: The type or namespace name `EventWrittenEventArgs' could not be found. Are you missing an assembly reference?
Context/TplFrameworkListenerBase.cs(147,69): error CS0246: The type or namespace name `EventWrittenEventArgs' could not be found. Are you missing an assembly reference?
I've tried also adding the nuget package as well as manually adding a reference to System.Diagnostics.Tracing.dll and including the dll in the repo. When I manually add the reference it says I have two of the same references included in the project and won't build. Is there a way to get this working or are these properties just not implemented in the newest version of mono?

asp.net mvc3 application opened in Visual Studio 2012, Could not locate the assembly "EntityFramework"

I opened and edited an ASP.NET MVC 3 application developed in Visual Studio 2010, in Visual Studio 2012. It was working fine in Debug mode but when I tried to publish it (release mode), it failed and threw following warnings and errors.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "EntityFramework". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
error CS0234: The type or namespace name 'Infrastructure' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)
error CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'DbModelBuilder' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)
EntityFramework.dll is present in bin folder and EntityFramework 5.0 is installed. Can this be resolved ?
What am I doing wrong while migrating this project? Microsoft says no modifications are needed when going from VS 2010 to VS 2012 http://msdn.microsoft.com/en-us/library/vstudio/jj161050.aspx#ASP.
If there is a file called packages.config in the project, open it and remove the reference to EntityFramework (something like <package id="EntityFramework" ... />). Also remove the reference to the assembly from the project (select the assembly under 'References' and delete it) and remove the assembly from the bin folder.
Now you can reinstall the package using the package manager (right click the project and select "Manage NuGet Packages").

Shared classes are build under VS2008 only but not under MSBuild

We share our classes between silverlight 3.0 client and server as is it described here. Everything works fine under Visual Studio 2008 only. Using msbuild with following command line parameters:
C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe FoobarApplication.sln /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU"
we get following error:
Class1.cs(28,54): error CS0234: The type or namespace name 'WcfService' does not exist in the namespace 'Company.FoobarApplication' (are you missing an assembly reference?)
Service References\geoServiceReference1\Reference.cs(24,81): error CS0234: The type or namespace name 'WcfService' does not exist in the namespace 'Company.FoobarApplication' (are you missing an assembly reference?)
Done Building Project "C:\work\bov-tmp\FoobarApplication\SilverlightClassLibrary3\SilverlightClassLibrary3.csproj" (Rebuild target(s)) -- FAILED.
Done Building Project "C:\work\bov-tmp\FoobarApplication\FoobarApplication.sln" (Rebuild target(s)) -- FAILED.
I found exactly the same question here. There are 4 workarounds there, I tried first 3 of them and those did not worked out. The 4-th workaround is not the acceptable solution.
Any thoughts how to build the solution?
Resolved the problem. The geoServiceReference1 project was referencing our RUI.Web project. That stupid reference appeared somehow after the solution reorganization.

Categories