C# Using and Compiling Windows.Form - c#

I am working on coding a GUI with C#. I'm following this simple tutorial to get started. To compile, I need to reference System.Windows.Forms.DLL System.Drawing.DLL, so I type
csc /r:System.Windows.Forms.DLL /r:System.Drawing.DLL FirstForm.cs
However, I get errors like this:
FirstForm.cs(6,14): error CS0012: The type 'System.ComponentModel.Component' is
defined in an assembly that is not referenced. You must add a reference
to assembly 'System, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.dll:
(Location of symbol related to previous error)
I've already added "c:\Windows\Microsoft.NET\Framework\v4.0.30319" to my path. I don't know why it's telling me to reference it when I already have.

You need to add /r:System.DLL to your command line arguments

Related

Problem using Windows.Devices.Bluetooth.GenericAttributeProfile reference

I am trying to use the C# library GattCharacteristic and I'm having trouble with references. I used Nuget to get the UwpDesktop package which was a suggestion posted elsewhere.
'Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic' in assembly 'Windows' causes a cycle.
The type name 'GattCharacteristic' could not be found in the namespace 'Windows.Devices.Bluetooth.GenericAttributeProfile'. This type has been forwarded to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly.
I've also tried adding the windows.winmd reference and adding <TargetPlatformVersion>10.0</TargetPlatformVersion> to the .csproj file with no success.

ASP.NET Boilerplate - Error building new project for MVC and EF combo

I have just downloaded, today, the free startup template for MVC5 and EF.
On opening, restoring all packages then building, I get the following build error in the "Core" project:
Error CS0508 'AppSettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext)': return type must be 'IEnumerable' to match overridden member 'SettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext)'
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
As the error message suggested, I added the reference to the assembly, however, that produced a whole lot of other errors.
Looking at the sample projects, they are using v2.1.3 of the APB assemblies and they compile fine.
The latest downloaded sample uses v3.0.0 of the APB assemblies.
Any help to get this up and running is appreciated. Thanks in advance.
Error CS0508 'AppSettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext)': return type must be 'IEnumerable' to match overridden member 'SettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext)'
AppSettingProvider already does that. Make sure you didn't modify the return type in that file.
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Update to VS2017 15.3.3+. For VS2015, install NETStandard.Library.NETFramework package.

The type 'Attribute' is defined in an assembly that is not referenced

Hello I am working on a Xamarin cross platform application using PCL for code sharing, and when I try to build the solution, I have the following error message:
Error CS0012 The type 'Attribute' is defined in an assembly that is
not referenced. You must add a reference to assembly 'System.Runtime,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I am targeting version 4.5 of the .NET framework. This error occured when I build, on a file generated in the obj folder.
I tried changing the references of the project but the only reference is "NET" (version 4.0.0) and I can't delete it nor add any other system reference so I don't know what to do.

Windows 10: How do you create a PhoneLine class?

I would like to programatically make a call with my windows phone 10, however I have no idea how to create a PhoneLine class can someone point me how to do it?
I am both new to C# and the mobile world.
I found the API reference here:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.calls.phoneline
and what I attempted to do is:
new Windows.ApplicationModel.Calls.PhoneLine();
However what I get is:
Severity Code Description Project File Line Suppression State
Error CS1069 The type name 'PhoneLine' could not be found in the
namespace 'Windows.ApplicationModel.Calls'. This type has been forwarded to
assembly 'Windows.Foundation.UniversalApiContract, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider
adding a reference to that assembly. App2 C:\documents\visual studio
2015\Projects\Helloworld2\App2\MainPage.xaml.cs 33 Active
As the error says ,
This type has been forwarded to assembly
'Windows.Foundation.UniversalApiContract, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'
Consider adding a reference to that assembly
You need to add Windows.Foundation.UniversalApiContract dll to the project as reference
If you read the error carefully you can see that it says this:
"This type has been forwarded to
assembly 'Windows.Foundation.UniversalApiContract,
Version=3.0.0.0,
Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider
adding a reference to that assembly."
You need to add a reference to the Windows.Foundation.UniversalApiContract assembly, as the class you are looking for has been moved over there instead.
According to this blog it can be found here:
C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0\Windows.Foundation.UniversalApiContract.winmd
Remove (x86) from the path if you're on a 32-bit system.

Orchard CMS: RemoteRss from Vandelay Industries

I'm stumbling my way around Orchard CMS and want to override the default template for the RemoteRSS widget from Vandelay Industries. The current template is located at:
~/Modules/Vandelay.Industries/Views/Parts/RemoteRss.cshtml
So,
Is it possible to override this template
If so, where do I place my new template, so as to not 'damage' the original
I've tried saving it as:
C:\inetpub\wwwroot\cc_orchard_live_2012\Themes\FlexoPurchased\Views\RemoteRss.cshtml
C:\inetpub\wwwroot\cc_orchard_live_2012\Themes\FlexoPurchased\Views\Parts.RemoteRss.cshtml
C:\inetpub\wwwroot\cc_orchard_live_2012\Themes\FlexoPurchased\Views\Parts\RemoteRss.cshtml
but these either seem to not take effect or even cause an error.
Thanks in advance.
Additional Info
C:\inetpub\wwwroot\cc_orchard_live_2012\Themes\FlexoPurchased\Views\RemoteRss.cs‌​html
Doesnt appear to have any effect.
~/Modules/Vandelay.Industries/Views/Parts/RemoteRss.cshtml
Same code here works fine however.
C:\inetpub\wwwroot\cc_orchard_live_2012\Themes\FlexoPurchased\Views\Parts.Remote‌​‌​Rss.cshtml
causes a runtime error: Compiler Error Message: CS0012: The type 'System.Xml.IXmlLineInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
C:\inetpub\wwwroot\cc_orchard_live_2012\Themes\FlexoPurchased\Views\Parts\Remote‌​‌​Rss.cshtml
throws a runtime error: Compiler Error Message: CS0012: The type 'System.Xml.IXmlLineInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
You need to reference System.Xml from your theme's project in order to be able to override that template.
You can overcome this problem by copying System.Xml.dll into your site's /bin folder. No further configuration is needed.
If you don't know where to find this file, create a new web project, add a reference to System.Xml to your project, right click on the new reference in the references list, go to the Copy Local property and change it to true. When you build the project, System.Xml.dll will be copied to your project's /bin directory. You can get it from there.

Categories

Resources