简体   繁体   中英

Reference not working in Visual Studio 2015

I currently am trying to set up an interface for a class, and I want to keep all of my interfaces in a separate project in my solution.

I have tried solutions at I can't reference my class library with no success.

Here is my interface:

using System;
using System.Collections.Generic;
using System.Text;

namespace SharedCal.Contracts.Models
{
    public interface IEvent
    {
        int id { get; set; }
        string title { get; set; }
        DateTime start { get; set; }
    }
}

My Class: (Error on using statement and error on IEvent)

using System;
using System.ComponentModel.DataAnnotations;
using SharedCal.Contracts.Models;

namespace SharedCal.Application.Models
{
    public class Event : IEvent
    {
        [Key]
        public int id { get; set; }
        public string title { get; set; }
        public DateTime start { get; set; }
        public DateTime end { get; set; }
        public bool allDay { get; set; }
        public string backgroundColor { get; set; }
        public string borderColor { get; set; }
    }
}

I have attempted to add the reference for the Contract project to the Application project, and I can see the reference has been successful added:

在此处输入图片说明

I have also attempted to close all VS tabs, and restart the program.

Thank you

EDIT

Seems that the problem exists based on the outpath values not being correctly set. Looking into this now in other posts - will post solution if found.

The solution I am working on is very small, and was able to simple copy the source files I needed from the Contracts project into a temporary location.

I then recreated the Contracts project and set up the reference from the Application project. Copied back in the source files and everything worked.

Unfortunately not quite sure what the actual error was - but I have a feeling it had to do with settings within the .csproj file for Contracts.

Thank you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM