I was trying repository pattern with ASP.Net 5 project and service project. I referenced my ".Service" class library project into my ".Web" project but something went wrong with the reference. I removed all referenced to other libraries, even removed my ".Service" and ".Web" projects and added new empty ones but the newly created ".Web" project still referencing the old version of deleted ".Service" project.
".Web" > ASP.Net 5 project.
".Service" > .Net Framework 4.5.1 class library project.
[URL for project on github]
https://github.com/ahmedhelmy204/Publess/tree/master/Publess
Screenshot of the current issue state
Your repository don't Publess.Data, which you reference and includes Publess.Core on the wrong place (see here and compare with github.com/ahmedhelmy204/Publess/tree/master/Publess/artifacts/...). Moreover the wrap folder contains EntityFramework.SqlServer and EntityFramework, which should be removed.
The directory wrap/EntityFramework.SqlServer for example contains project.json with wrong version number 1.0.0 for EntityFramework and it informs to get EntityFramework.SqlServer.dll from .../Publess.Data/bin/Debug folder
{
"version": "1.0.0-*",
"frameworks": {
"net451": {
"bin": {
"assembly": "../../Publess.Data/bin/Debug/EntityFramework.SqlServer.dll"
},
"dependencies": {
"EntityFramework": "1.0.0-*"
}
}
}
}
The wrap folder will be created when you add old project or old assembly to new ASP.NET 5 project. The entries wrappedProject and bin with assembly and pdb will be created. One can use Visual Studio or dnu wrap to do this (see dnu wrap -h). See the answer, the documentation or the post.
Some additional advices can gives you the source code of dnu wrap. See here and here and here
Related
I'm coming from the Visual Studio world of solutions, where each solution can consist of multiple projects that can refer to each other.
What I want to do is create a modular Android project in Android Studio such that all my code doesn't live in one huge app project. However, it seems terribly difficult to do this, so much so that I am sure I am doing something wrong.
I created a blank project called MyProject. This creates a project with the name MyProject and a package com.sohum.myproject. There is a single app project contained within containing no source files.
I now want to add another module under the same namespace (e.g. com.sohum.myproject.library1). However, it seems when I try to add a new module via the menu, I can only do so into a com.sohum.library1 project. How do I get it to use the same package as the project?
My end goal is to have all my modules under the com.sohum.myproject package, referencing each other. For example:
com.sohum.myproject.application will be the entry point. It might depend on com.sohum.myproject.library1 and com.sohum.myproject.someotherlibrary. And I would like to see all of these modules when I open the MyProject file.
You can click File > New > New Module. Then choose Android Library and enter the details.
Reference: https://developer.android.com/studio/projects/android-library
Another way is to set up the project in a subpackage when creating it.
For example, create a project MyProject in a root directory. Call the application Application and rename the package to be com.sohum.myproject.app instead of just com.sohum.myproject. Now any new modules created will be added below the com.sohum.myproject package space.
A .csx file inside an Azure Function can use a nuget package if it's listed in the function's project.json file. Ex:
{
"frameworks": {
"net46":{
"dependencies": {
"Microsoft.ProjectOxford.Face": "1.1.0"
}
}
}
}
But what happens with shared .csx files that are placed under the Function App's root (i.e. not in a specific function)? Is there a way to introduce a nuget package at the App Function (root) level?
I've found a workaround in uploading the nuget package's dll to a shared bin folder as explained in the Azure Functions C# developer reference:
Shared assemblies are shared across all functions within a function app. To reference a custom assembly, upload the assembly to your function app, such as in a bin folder in the function app root.
Is there a way to do this better so my code depends on the nuget package and not on a dll?
The actual package references are managed in each function (i.e. there's no function app level set of package references), but when brought into your function by using the #load directive, shared CSX files become part of the same compilation unit, and are able to consume assembly/package references defined in your function. But you still need to manage those at the function level.
You can think of the #load behavior as a linked file in a regular C# project, where the file is brought in, but compiled within the context of the project. That applies to functions here.
I am facing strange issues with privates assemblies in azure functions, I have an Azure Function App with five functions which have a shared bin folder where I place my assemblies, these assemblies in turn depend on Entity Framework and LinqKit for which I have added dependencies in all the project.json files for each function but private assemblies are unable to get reference to these and failing. Please help.
Project.json --
{
"frameworks": {
"net46":{
"dependencies": {
"EntityFramework": "6.1.3",
"Newtonsoft.Json": "9.0.1",
"LinqKit": "1.1.7.2"
}
}
}
}
To clarify further in my Function App I have five different functions which depend on 2 private assemblies and I do not want to keep separate copies (as this might cause different versions of the same dll in different folder causing issues) in each function so I have created a shared bin folder from where the private assemblies are referenced but the issue happens as these private assemblies further depend on some nuget packages which they are not able to find them --
#r "..\bin\Marketware.Domain.dll"
#r "..\bin\Marketware.AzureIntegration.dll"
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Diagnostics.Eventing.Reader;
If you want to use your private assembly (not from nuget) you have to do this:
Connect to Functions App ftp
Create bin folder in folder with your function (where is run.csx)
Upload your custom assembly to newly created bin folder
Update function code and add reference
Unfortunately this dll needs to be in each function folder where needed.
Example
#r "CustomAssembly.dll"
using System.Net;
using CustomAssembly;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
CustomAssemblyClass.MethodName(); // here call your method
return req.CreateResponse(HttpStatusCode.OK, "");
}
Will spend a bit of time trying to repro your scenario as, at a first glance, it should work as expected. In the meantime, a couple of options you have are:
1- When deploying your shared assemblies, copy all the binaries from your project output, including their dependencies. The shared assemblies folder will be in the probing logic and they would be resolved from there. This would also eliminate the need to have a project.json referencing the dependencies on each function.
2- Create a NuGet package for your shared assemblies and, on that package, specify your package dependencies (EF and LinqKit), publish that package to a private feed (which could be something like MyGet or even a folder in your function app). Your functions would only need to reference that package and not its dependencies, as those would be automatically resolved. You can find more information about using custom sources here: How do you use custom NuGet feeds with Azure Functions?
Although it may require a bit more work at first, both options have advantages over your original approach (including eliminating the need for the functions to be aware of indirect dependencies) and should be more reliable.
Hope this helps!
There is a problem with importing Cardboard SDK to my project.
I downloaded cardboard-java Github repository
then copied the files from it's library to my project's library folder and added the following dependencies:
compile project(':libraries-common')
compile project(':libraries-commonwidget')
compile project(':libraries-videowidget')
But it gives error saying:
Project with path ':libraries-common' could not be found in project
':app'.
Please help me to understand what I'm doing wrong, and tell me if there is another way of importing the SDK.
Thanks
The project syntax is used to describe a dependency on a separate subproject of your root Gradle project. Note that the example repository is aware of all the library subprojects. You probably need to update your own settings.gradle to similarly be aware of the library subprojects you have copied into your Android Studio project.
Alternatively, start over and make sure you follow every step from this Getting Started guide. In particular, using the New module import method should automatically update your settings.gradle file as you go:
First, grab all the required .AAR files from the libraries folder of the sdk. To determine which .AARs you need to depend on, you can examine the build.gradle files of the various sample apps. For example, samples/treasurehunt/build.gradle's dependency section has the following entries:
dependencies {
compile project(':libraries-audio')
compile project(':libraries-common')
compile project(':libraries-core')
}
This indicates that an application similar to the Treasure Hunt sample needs the audio, common, and core libraries.
Create new modules for each of these libraries. Using Android Studio's GUI, this can be done via File -> New -> New Module.... Select Import .JAR/.AAR Package. Locate one of the .AARs and import it.
Then add this new module as a dependency to your main app via File -> Project Structure -> Modules (on the left side's section list) -> YOUR APP's MODULE NAME -> Dependencies (on the right side's tab list) -> '+' -> Module Dependency.
I have an Asp.Net Web Api solution with 3 class library projects that are referenced from the main project. I have published the main project to another server on site - MySite/Main. I am unable to figure out how to publish the class library projects to location like so -
MySite/CL1
MySite/CL2
MySite/CL3
This shall enable the main project to reference them properly. How should I go about it?
When you build your web project all the referenced libraries are being copied to the bin folder (check for yourself). This folder is also being published.
If you use IIS it will automatically look for assemblies in the bin folder so you shouldn't worry about making the folder structure to be the same as in your local environment.
So the only thing you should worry about is referencing libraries properly.
The website project is the only one which should be published. You don't need to publish class libraries (I don't think you can do this using Visual Studio)