Shared classes are build under VS2008 only but not under MSBuild - c#

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.

Related

C# - Recompiling old code, running into errors (are you missing an assembly reference?)

First and foremost, I've never worked with C#, or any compiled language for that matter. So I'm hoping I'm just doing something wrong here.
We have an old in house app, written in c# that has some smtp settings hard coded that need to be changed. I have the source files, and even the .sln visual studio project file. So I open the project in vs, make the required changes, and go to build- however I'm running into errors (Build -> Build 'Autodocs' (the name of our app)):
Build started...
1>------ Rebuild All started: Project: AutoDocs, Configuration: Debug Any CPU ------
1>C:\shared\New folder\AutoDocs\Microsoft\Office\Interop\Word\Documents.cs(10,38,10,54): error CS0234: The type or namespace name 'CustomMarshalers' does not exist in the namespace 'System.Runtime.InteropServices' (are you missing an assembly reference?)
1>C:\shared\New folder\AutoDocs\AutoDocs\modules\DWStorer.cs(7,7,7,15): error CS0246: The type or namespace name 'DocuWare' could not be found (are you missing a using directive or an assembly reference?)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
So does anybody have any suggestions for a c# newbie like me? Anything I should have to do when copying a project dir from the server to my pc to build it?
Thank you in advance.
Do you know what kind of program it is? Windows? ASP.NET? MVC?
The errors are shown, but let's go through them:
1>C:\shared\New folder\AutoDocs\Microsoft\Office\Interop\Word\Documents.cs(10,38,10,54):
error CS0234: The type or namespace name 'CustomMarshalers' does not exist in the
namespace 'System.Runtime.InteropServices' (are you missing an assembly reference?)
First, look in this document:
C:\shared\New folder\AutoDocs\Microsoft\Office\Interop\Word\Documents.cs
Somewhere in that file, when viewing in Visual Studio, you will see the word CustomMarshalers, and it needs to be referenced.
So, in your project, you will need to right-click the References section and add that missing reference (if it isn't there already):
Also, at the top of your Documents.cs file, you need to have a line like this:
using System.Runtime.InteropServices;
See Microsoft's documentation here: System.Runtime.InteropServices.CustomMarshalers
Here is your second error:
>C:\shared\New folder\AutoDocs\AutoDocs\modules\DWStorer.cs(7,7,7,15):
error CS0246: The type or namespace name 'DocuWare' could not be found
(are you missing a using directive or an assembly reference?)
Similar to the first error, this one is having an error in the DWStorer.cs file because it cannot resolve the keyword DocuWare.
DocuWare is a third party tool that must be added to your references and added to the top of your DWStorer.cs file.
DocuWare
You may have to go to the link above to download their tool if you do not have it in your project somewhere.

Why i cannot build the test project in Msbuild Teamcity using the project solution file?

UnitTest1.cs(131,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?)
16:42:40
UnitTest1.cs(131,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?)
16:42:40
UnitTest1.cs(144,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?)
Why i cannot build the test project in Msbuild Teamcity using the
project solution file?
First of all, you should make sure that you can build your test project successfully locally.
Then, follow these suggestions:
Suggestions
First, Before Teamcity 9.1.5, you should install Microsoft Visual Studio edition on the build agent and make sure that you install the right version. Please see this official document.
Since TeamCity 9.1.5, the Visual Studio Test Runner supports Visual Studio Test Agent installed on the agent machine (Microsoft Visual Studio is no longer required). You can refer to this link.
Second, you should do the restoration of the nuget packages at VCS before build step.
See this.

The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Getting the error
The type or namespace name 'VisualStudio' does not exist in the
namespace 'Microsoft' (are you missing an assembly reference?)
on a project using MS Test 2 Framework. I read the link here but it didn't help.
I believe I have the required references and object browser seems to find them:
References
Object Browser:
Nevertheless I'm getting tons of errors in my unit test project, starting with the one above.
How can I resolve this so the build can find the references it needs?
In my case (vs2017 + TFS Builds), I ended up removing the MSTest v2 packages and installed the MSTest v1 package because our build servers don't support v2 yet. My solution would build locally but fail on our build server.
Went into Manage NuGet Packages
Uninstalled MSTest.TestAdapter & MSTest.TestFramework
Installed VS.QualityTools.UnitTestFramework
Rebuild & Run tests to make sure and then check-in.

Several system libraries missing in a VS Express install

I am having a problem I am trying to troubleshoot. I developed a website in VS 2013, and am trying to set the website up for continuous integration on a server using teamcity.
I have already tested teamcity on my computer, and have it compiling perfectly using a VS2013 install.
On the server, I have everything working...except for the compilation. In order to compile the website, I installed VS Express on the server. The problem is, a new error is appearing on the server:
System.Net.Http.Formatting and
System.Web.Http
...are both missing.
Are they missing because of some error? Because I am using VSExpress instead of VS2013?
The actual error is:
Security\ApiAuthentication.cs(7, 23): error CS0234: The type or namespace name 'Formatting' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)
Security\ApiAuthentication.cs(12, 18): error CS0234: The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Security\ApiAuthentication.cs(21, 49): error CS0234: The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Security\ApiAuthentication.cs(32, 48): error CS0246: The type or namespace name 'HttpActionContext' could not be found (are you missing a using directive or an assembly reference?)
I've got VS Community 2013 on my local, in the base install the System.Net.Http namespace exists but System.Net.Http.Formatting does not. This is the same with System.Web vs System.Web.Http.
On installing the Microsoft.AspNet.WebApi.Core NuGet package both appeared as expected and could be referenced.
Have you tried adding a NuGet Restore step to your TeamCity build before compiling? It's strange mind that these are the only errors you are seeing if there's been no NuGet restore in place. Maybe a build order issue / red herring?

Failed when creating a skeleton WiX extension

I just started using WiX, with zero knowledge of C#/.NET
Now I'm trying to create a simple WiX extension by referring this page: WiX3 - Simple Example of Extension.
Here is steps described in that page:
In Visual Studio, create a new C# library (.dll) project named SampleWixExtension.
Add a reference to wix.dll to your project.
Add a using statement that refers to the Microsoft.Tools.WindowsInstallerXml namespace.
using Microsoft.Tools.WindowsInstallerXml;
Make your SampleWixExtension class inherit from WixExtension.
public class SampleWixExtension : WixExtension {}
Add the AssemblyDefaultWixExtensionAttribute to your AssemblyInfo.cs.
[assembly: AssemblyDefaultWixExtension(typeof(SampleWixExtension.SampleWixExtension))]
Build the project.
However, when I finished these steps and built this project, I met following errors:
------ Build started: Project: SampleWixExtension, Configuration: Debug Any CPU ------
D:\working\test\SampleWixExtension\SampleWixExtension\Properties\AssemblyInfo.cs(37,12): error CS0246: The type or namespace name 'AssemblyDefaultWixExtension' could not be found (are you missing a using directive or an assembly reference?)
D:\working\test\SampleWixExtension\SampleWixExtension\Properties\AssemblyInfo.cs(37,12): error CS0246: The type or namespace name 'AssemblyDefaultWixExtensionAttribute' could not be found (are you missing a using directive or an assembly reference?)
Compile complete -- 2 errors, 0 warnings
Anyone know why and how to fix it?
Btw, in the Solution Explorer I can see wix is already in References, its properties has Path of C:\Program Files (x86)\Windows Installer XML v3.5\bin\wix.dll
By adding
using Microsoft.Tools.WindowsInstallerXml;
into AssemblyInfo.cs, the project is now successfuly built.

Categories