Using Entity Framework Power Tools Beta 2 extension, it generates model classes with the following imports:
using System.Data.Entity.Infrastructure;
What reference do I need to include into my project using Visual Studio 2010?
Currently, I have the following References:
log4net
System.configuration
System.Core
System.Data
System.Data.Entity
System.Web
System.Web.Mvc
System.XML
And in the Add Reference dialog I have the following:
Don't add EF lib via "Add reference" dialog (it's old version)
You need to add NuGet package "EntityFramework" of latest version.
Related
I am trying to install MySql.Data and MySql.Data.Entity to my class lib.
Somehow there is no reference added to the project.
Things I've tried:
Update-Package -reinstall (does not help)
packages.config contains the correct entries
*.csproj also has the correct entries
Cleared NuGet-Cache
This is the output:
Package 'MySql.Data.6.10.6' already exists in folder
'C:\Users\MYUSERNAME\Documents\Repositories\XXXXXXX\packages'
Added package 'MySql.Data.6.10.6' to 'packages.config'
Successfully installed 'MySql.Data 6.10.6' to XXXXXXXX.Persistence
Executing nuget actions took 1,6 sec
Strange thing is that NuGet creates that \docs in my project which is part of MySql
Nuget-package not adding package reference
I agree with Matt`s comment. You project targets framework should be .NET 4.5.1 or below. Because the package MySql.Data only contain assembly reference to .NET framework 4.5.2 for .NET framework:
However, this package also have the content files, which are compatible with .net framework. So when you add this package to the project(target framework 4.5.1 or below), nuget will install this nuget package without any error, just add the content file (\docs) but not add any reference to the project.
To resolve this issue, you can change the target framework to 4.5.2 and above of this project or you should use the nuget package MySql.Data with the version 6.9.11, which contain assembly reference to .NET framework 4.0 and 4.5:
Note: If you change the target framework to the .net framework 4.5.2 and above, you may get the error "The package 'MySql.Data' tried to add a framework reference to 'System.ComponentModel' which was not found in the GAC.", please add a manually reference to missed library:
Package tried to add reference to System.Runtime which was not found in the GAC
Hope this helps.
I experienced this problem even though I had the correct Framework.
It was solved by Migrating the Nuget Format to Package References
For visual studio latest versions you have to right click on Dependencies > Manage NuGet Packages > click in the settings button with a flower-like shape, then in NuGet Package Manager option choose General, and change Default package management format from packages.config to PackageReference.
If that does not do the trick, then you will have to add the packages through the CLI tools, looking into the nuget gallery and pasting the comand directly with the desired version, like for example:
dotnet add package Microsoft.EntityFrameworkCore.Design --version 6.0.10
I need to use some classes from another project. How can I just import or create a reference to that project in Visual Studio?
Right now if I use "Add reference" in Visual Studio, I get the error:
".NET Core projects only support referencing .NET framework assemblies in this release. <br/>
To reference other assemblies they need to be included in a NuGet package"
.NET Core works with dependencies via NuGet.
If your projects are in the same solution, then yes, you can add a reference using the Visual Studio UI ("Add reference" command). A background reference will be added as a NuGet package.
Manually you can do this by adding <ProjectReference> section to the .csproj file:
<ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj" />
Otherwise, you should pack your project into a NuGet package (use the dotnet pack command) and then add it as other NuGet packages.
If you do not use any public NuGet sources, you can host your own NuGet feed.
You have the next error:
".NET Core projects only support referencing .NET framework assemblies in this release.
To reference other assemblies they need to be included in a NuGet package"
Because you are trying to add a .NET project to a .NET Core project or wise versa. Look into this issue for more details:
If you're using netcoreapp then you cannot use .NET 4.x
assemblies/packages
If you're using net4xx then you can use the frameworkAssemblies
section of project.json to reference DLL files that are installed by
.NET Framework (the stuff in the GAC)
I had a .Net core project and i wanted to create another project for services in my solution. After adding the project I added the reference as follows:
Right click Dependencies in your solution.
Select Add Reference option.
In the next window, in Projects dropdown select the project you want to add.
Alternatively, you can add a reference by editing the csproj file of the project in which you want to add the dependency/reference. Open the file and add the following:
<ItemGroup>
<ProjectReference Include="..\PATH\TO_YOUR_NEW PROJECT.csproj" />
</ItemGroup>
Hope this helps someone.
You can add reference by adding your project name in csproj file. if your project in same solution
<ItemGroup>
<ProjectReference Include="..\projectName.csproj" />
<ProjectReference Include="..\ProjectName2.csproj" />
<ProjectReference Include="..\ProjectName3.csproj" />
I have a Project Template that I want to make available to people that I work with. How should project templtes (and item templates) be deployed? According to MSDN on this page (https://msdn.microsoft.com/en-us/library/xkh1wxd8.aspx) you should use a vsix package, but template wizards must be installed to the GAC and a vsix package cannot do that.
It seems that you don't need the GAC after all. See:
Using IWizard in an item template without installing assembly in GAC?
Using IWizard in an item template without installing assembly in GAC?
My MVC 3 project is building successfully in my development machine with Visual Studio 2010 + MVC 3. In the build server, VS2010 is not used and I've installed 'ASP.NET MVC 3 Tools Update'. I've also downloaded NAnt and used TortoiseSVN to checkout all the files except bin directories.
But while building using Nant default.build, I'm getting build error
'The type or namespace name 'Mvc' does not exist in the namespace
'System.Web'
(are you missing an assembly reference?). Same with 'Controller', 'ActionResult', 'GlobalFilterCollection' etc (type or namespace could not be found).
I can see System.Web.Mvc.dll in
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35\
. What am I missing here? Why NAnt can't find this file? Is there no other way than copying the assembly files into local bin?
I had the same issue and wasn't able to locate the System.Web.MVC reference assembly.
Finally found out and it was located inside the following location.
Note if your VS was installed in C: (Sometimes the MVC is not in the defaul location which everybody talk about, i mean the "Reference Assemblies" folder located in the C: drive.
if its not there, it should definitely be in here:
Program files(x86) --> Microsoft ASP.NET --> ASP.NET MVC 2 --> Assemblies System.Web.Mvc.dll
Hope this one is helpful.
Here is my answer -
Best way is to use NuGet package manager.
Just update the below MVC package and it should work
Why is System.Web.Mvc not listed in Add References?
If you use NuGet packages, you need to update MVC package. This worked for me.
If you Installed MVC Package from NuGet packages. simply uninstall package and install it again.
It's work for me
Which version of msbuild are you using to build the web project?
Is the web project referencing a specific version of or file path to System.Web.Mvc.dll?
Download and install ASP.NET MVC 3:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=4211
According to: http://weblogs.asp.net/scottgu/archive/2011/05/03/asp-net-mvc-3-tools-update.aspx
"The ASP.NET MVC 3 Tools update only includes Visual Studio tooling improvements and default project template changes – it does not include any changes to the ASP.NET MVC 3 runtime binaries."
I have a project that uses the Enterprise Library 4.1. When I target .net 4 and compile, I get an error that says I need to add a reference to System.ServiceModel version 3. My reference is to System.ServiceModel version 4. How can I tell Visual Studio 2010 to reference a .net3 assembly from a .net3 project? Or, does somebody have a workaround for this issue?
I am using the RTM version of VS2010
Thanks
Some references in the csproj file (e.g. System.ServiceModel in ExceptionHandling.WCF project) have the SpecificVersion property set to True.
You can right click on this reference and choose Properties and change this value to False. Alternatively you can edit the csproj file in notepad and change <SpecificVersion>True</SpecificVersion> to <SpecificVersion>False</SpecificVersion> for this reference