Cannot add package reference - c#

I'm building a xamarin.ios app in VS mac. I'm trying to add a certain package, but when I try to add it I get this error
jon#jons-MacBook-Pro-2 helloworld % dotnet add package Ditto
/Users/jon/Desktop/hello-world/helloworld/helloworld/helloworld.csproj(140,5): error MSB4019: The imported project "/usr/local/share/dotnet/sdk/6.0.300/Xamarin/iOS/Xamarin.iOS.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/usr/local/share/dotnet/sdk/6.0.300//Xamarin/iOS/Xamarin.iOS.CSharp.targets" is correct, and that the file exists on disk.
Unable to create dependency graph file for project '/Users/jon/Desktop/hello-world/helloworld/helloworld/helloworld.csproj'. Cannot add package reference.
I have also tried using the Nuget manager and I get this when I try to build the project
/Users/jon/Desktop/hello-world/helloworld/helloworld/MTOUCH: Error MT0009: Error while loading assemblies: /Users/jon/.nuget/packages/ditto/1.1.8/runtimes/win/native/dittoffi.dll. (MT0009) (helloworld)
Any thought??

Related

msbuild throwing error for added link for resource in c# project

I want to create a common Version.cs which has copyright and assembly version infromation. I want same file to be refered by 2 projects using Add Link feature. So whenver there is new release I just want to make changes in Version.cs file. My both the prjected located in below location.
Below two projects are generated from
Project 1
C:\remote\local\Sources\myproj-template-archetype\target\test-classes\projects\snap_proj\project\snap_proj\MyLibrary_1
Project 2
C:\remote\local\Sources\myproj-template-archetype\target\test-classes\projects\snap_proj\project\snap_proj\MyLibrary_2
My Version.cs is located in C:\remote\local\Version.cs
Now when I try to build these project using mvn clean install. I am getting error for Version.cs. Error is
[INFO] [exec] CSC : error CS1566: Error reading resource
'Com.org.snap_proj.MyLibrary_1.Com.org.snap_proj.MyLibrary_1.Version.cs'
-- 'Could not find a part of the path 'C:\remote\local\Sources\myproj-template-archetype\target\test-classes\projects\snap_proj\project\snap_proj\MyLibrary_1\Com.org.snap_proj.MyLibrary_1\Version.cs'.'
[C:\remote\local\Sources\myproj-template-archetype\target\test-classes\projects\snap_proj\project\snap_proj\MyLibrary_1.csproj]

System.Data.SQLite.dll isn't found trying to add a reference

(Beginner level)
I have a DB in SQLite3.
I would like to populate a DataGridView by data from the DB.
Currently I'm at the first phase to create a connection/using.
Also, when I add this: using System.Data.SQLite; I get an error:
Error CS0234 The type or namespace name 'SQLite' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
In this tutorial it guides to add System.Data.SQLite.dll as reference - in folder Program Files (x86) should appear System.Data.Sqlite, but the folder does not exist. The dll file cannot be found, I searched for it also in the Reference Manager Browse.
(Thanks in advance)
First Add With Nuget Syste.Data.SqLite.
or run the command in the Package Manager Console
Install-Package System.Data.SQLite
Then right click on your project references, an select add reference.
Select Under Assemblies, Framework.
Then left click on System.Data.SQLite.
This will add Mono.Data.SqLite to your reference.
So type in your code
using Mono.Data.Sqlite;
This reference is of the same use case as System.Data.SQLite.
You can add the assembly with NuGet. Install System.Data.SQLite.
To install System.Data.SQLite (x86/x64), run the following command in the Package Manager Console
Install-Package System.Data.SQLite

AppVeyor: Build Failed : Cant locate NUnit assembly

I'm having trouble building these simple tests using NUnit. Project passes the build using MStest, but as soon as I switch to NUnit it fails the build.
The error I'm getting during build process is basically:
Could not resolve this reference. Could not locate the assembly "nunit.framework". Check to make sure the assembly exists on disk. If
this reference is required by your code, you may get compilation
errors.
I have NUnit 3.5 downloaded from NUGET and added the .dll to my references, and still nothing. I also have also made sure the properties of that reference have the copy local property set to true.
Here is my build log URL on AppVeyor (https://ci.appveyor.com/project/ReevMich/traviscitest/build/1.0.26)
This is my appveyor.yml contents if that helps.:
version: 1.0.{build}
branches:
only:
- master
- dev
configuration: Debug
before_build:
- nuget restore
build:
verbosity: minimal
project: FizzBuzz.sln
test:
assemblies:
- '**\*.Test.dll'
artifacts:
- path: '**\*.nupkg'
name: NuGet
Remove packages folder from your repository (it doesn't contain assemblies anyway), so it's always re-created during the build with nuget restore.

Can't publish ASP.NET 5 with external library reference

I have included an external reference of Moneris library eSELECTplus_dotNet_API.dll to my ASP.NET 5 RC1 project. It wrapped it alright and I can build project and run it using Kestrel. But when I publish it from VS or command line I got following error:
The package ID 'eSELECTplus_dotNet_API' contains invalid characters. Examples of valid package IDs include 'MyPackage' and 'MyPackage.Sample'.
I tried to rename library to a better name to fit nuget specs and it worked so I can publish it. But now when I run my project I got runtime error saying following:
System.IO.FileNotFoundException : Could not load file or assembly 'eSELECTplus_dotNet_API, Version=2.5.3.0, Culture=neutral, PublicKeyToken=8cb9cd598f87e276' or one of its dependencies. The system cannot find the file specified.
Please advice.

NuGet Pack -Build does not seem to understand c# 6.0

I have just went through one of my projects and used a bunch of the new c# 6 features like the null propagation operator handler?.Invoke(null, e), which builds in Visual Studio. However, when I run my script to publish out the NuGet packages, I get compilation errors saying:
EventName.cs(14,66): error CS1056: Unexpected character '$'
EventName.cs(69,68): error CS1519: Invalid token '=' in class, struct, or interface member declaration
EventName.cs(69,74): error CS1520: Method must have a return type
It would appear NuGet is using an older version of the compiler, but I was wondering if anyone knew a work around or configuration that could be set to resolve the issue.
Looks like you have also found this bug in the Nuget which is still not resolved:
https://github.com/NuGet/Home/issues/1107
You can use the following workaround:
Modify the script to build your project using correct version of MSBuild - just call MSBuild.exe yourself, supply the path to the csproj or sln file and build your project in a correct configuration yourself.
Create a nuspec file that describes your package (https://docs.nuget.org/create/nuspec-reference). You can use the Nuget Package Explorer app. Use DLLs produced in step 1.
Use nuget pack mypackage.nuspec to build the package.

Categories