LiteDB- How to add 2 DLL of LiteDB in two different project but they are referenced by one Main project
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have created 3 projects:
- V_1_OperationProject:
(Class library project)To handle operation on LiteDb version 1 - V_4_OperationProject :
(Class library project)To handle operation on LiteDb version 4 - MainProject:
Gives the calls to methods in V_1_OperationProject and V_4_OperationProject project
V_1_OperationProject contains logic to open and inset into DB file created from LiteDB v1 dll and similarly with V_4_OperationProject.
When I am going to insert values in DB from V_1_OperationProject, I am getting following exception:
System.IO.FileLoadException: 'Could not load file or assembly 'LiteDB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
When I have removed V_4_OperationProject and its associated DLL then it got started working. But I want both to work.
So I have tried adding following in main project:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="LiteDB"
publicKeyToken="4ee40123013c9f27"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0-1.0.0" newVersion="1.0.0" />
<bindingRedirect oldVersion="1.0.1-4.0.0" newVersion="4.0.0" />
<codeBase version="1.0.0" href="LiteDB-1LiteDB.dll" />
<codeBase version="4.0.0" href="LiteDB-4LiteDB.dll" />
</dependentAssembly>
</assemblyBinding>
This is also not working for me.
Can anyone please help me in this??
Thanks in Advance
c# dll litedb
add a comment |
I have created 3 projects:
- V_1_OperationProject:
(Class library project)To handle operation on LiteDb version 1 - V_4_OperationProject :
(Class library project)To handle operation on LiteDb version 4 - MainProject:
Gives the calls to methods in V_1_OperationProject and V_4_OperationProject project
V_1_OperationProject contains logic to open and inset into DB file created from LiteDB v1 dll and similarly with V_4_OperationProject.
When I am going to insert values in DB from V_1_OperationProject, I am getting following exception:
System.IO.FileLoadException: 'Could not load file or assembly 'LiteDB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
When I have removed V_4_OperationProject and its associated DLL then it got started working. But I want both to work.
So I have tried adding following in main project:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="LiteDB"
publicKeyToken="4ee40123013c9f27"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0-1.0.0" newVersion="1.0.0" />
<bindingRedirect oldVersion="1.0.1-4.0.0" newVersion="4.0.0" />
<codeBase version="1.0.0" href="LiteDB-1LiteDB.dll" />
<codeBase version="4.0.0" href="LiteDB-4LiteDB.dll" />
</dependentAssembly>
</assemblyBinding>
This is also not working for me.
Can anyone please help me in this??
Thanks in Advance
c# dll litedb
I've done something similar in my project that referenced two different versions of the same DLL using <Aliases>. Have a look here: github.com/bzaar/DawgSharp/blob/master/…
– Sergey Slepov
Nov 23 '18 at 13:20
add a comment |
I have created 3 projects:
- V_1_OperationProject:
(Class library project)To handle operation on LiteDb version 1 - V_4_OperationProject :
(Class library project)To handle operation on LiteDb version 4 - MainProject:
Gives the calls to methods in V_1_OperationProject and V_4_OperationProject project
V_1_OperationProject contains logic to open and inset into DB file created from LiteDB v1 dll and similarly with V_4_OperationProject.
When I am going to insert values in DB from V_1_OperationProject, I am getting following exception:
System.IO.FileLoadException: 'Could not load file or assembly 'LiteDB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
When I have removed V_4_OperationProject and its associated DLL then it got started working. But I want both to work.
So I have tried adding following in main project:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="LiteDB"
publicKeyToken="4ee40123013c9f27"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0-1.0.0" newVersion="1.0.0" />
<bindingRedirect oldVersion="1.0.1-4.0.0" newVersion="4.0.0" />
<codeBase version="1.0.0" href="LiteDB-1LiteDB.dll" />
<codeBase version="4.0.0" href="LiteDB-4LiteDB.dll" />
</dependentAssembly>
</assemblyBinding>
This is also not working for me.
Can anyone please help me in this??
Thanks in Advance
c# dll litedb
I have created 3 projects:
- V_1_OperationProject:
(Class library project)To handle operation on LiteDb version 1 - V_4_OperationProject :
(Class library project)To handle operation on LiteDb version 4 - MainProject:
Gives the calls to methods in V_1_OperationProject and V_4_OperationProject project
V_1_OperationProject contains logic to open and inset into DB file created from LiteDB v1 dll and similarly with V_4_OperationProject.
When I am going to insert values in DB from V_1_OperationProject, I am getting following exception:
System.IO.FileLoadException: 'Could not load file or assembly 'LiteDB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
When I have removed V_4_OperationProject and its associated DLL then it got started working. But I want both to work.
So I have tried adding following in main project:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="LiteDB"
publicKeyToken="4ee40123013c9f27"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0-1.0.0" newVersion="1.0.0" />
<bindingRedirect oldVersion="1.0.1-4.0.0" newVersion="4.0.0" />
<codeBase version="1.0.0" href="LiteDB-1LiteDB.dll" />
<codeBase version="4.0.0" href="LiteDB-4LiteDB.dll" />
</dependentAssembly>
</assemblyBinding>
This is also not working for me.
Can anyone please help me in this??
Thanks in Advance
c# dll litedb
c# dll litedb
edited Nov 23 '18 at 14:42
Wayne Phipps
1,15442130
1,15442130
asked Nov 23 '18 at 13:05
Smiley Smiley
254
254
I've done something similar in my project that referenced two different versions of the same DLL using <Aliases>. Have a look here: github.com/bzaar/DawgSharp/blob/master/…
– Sergey Slepov
Nov 23 '18 at 13:20
add a comment |
I've done something similar in my project that referenced two different versions of the same DLL using <Aliases>. Have a look here: github.com/bzaar/DawgSharp/blob/master/…
– Sergey Slepov
Nov 23 '18 at 13:20
I've done something similar in my project that referenced two different versions of the same DLL using <Aliases>. Have a look here: github.com/bzaar/DawgSharp/blob/master/…
– Sergey Slepov
Nov 23 '18 at 13:20
I've done something similar in my project that referenced two different versions of the same DLL using <Aliases>. Have a look here: github.com/bzaar/DawgSharp/blob/master/…
– Sergey Slepov
Nov 23 '18 at 13:20
add a comment |
2 Answers
2
active
oldest
votes
You need to tell the runtime where to look for each version. You can do so using AssemblyResolve:
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name == "LiteDB, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null")
{
return Assembly.LoadFrom(@"......packagesLiteDB.1.1.1libnetLiteDB.dll");
}
// The most recent version will be copied to the output directory.
// Use the normal resolution mechanism to locate it.
return null;
}
I am frequently switching between two versions for performing DB operation , so can loading both LiteDB version in their respective projects V_1_OperationProject and V_4_OperationProject affect on each other? E.g. 1. In V_1_OperationProject LiteDb v1 is loaded 2. Do some DB operation in V_1_OperationProject 3. Swich to V_4_OperationProject project and load LiteDB v4 4. Do some DB operation in V_4_OperationProject 5. Come back to V_1_OperationProject project and do some operation
– Smiley
Nov 27 '18 at 11:34
add a comment |
The two LiteDB versions will have separate code and data. But there might be other ways for them to clash like sharing a common config, port numbers or whatever. I guess you will have to try and see if it works for you.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53447256%2flitedb-how-to-add-2-dll-of-litedb-in-two-different-project-but-they-are-referen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to tell the runtime where to look for each version. You can do so using AssemblyResolve:
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name == "LiteDB, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null")
{
return Assembly.LoadFrom(@"......packagesLiteDB.1.1.1libnetLiteDB.dll");
}
// The most recent version will be copied to the output directory.
// Use the normal resolution mechanism to locate it.
return null;
}
I am frequently switching between two versions for performing DB operation , so can loading both LiteDB version in their respective projects V_1_OperationProject and V_4_OperationProject affect on each other? E.g. 1. In V_1_OperationProject LiteDb v1 is loaded 2. Do some DB operation in V_1_OperationProject 3. Swich to V_4_OperationProject project and load LiteDB v4 4. Do some DB operation in V_4_OperationProject 5. Come back to V_1_OperationProject project and do some operation
– Smiley
Nov 27 '18 at 11:34
add a comment |
You need to tell the runtime where to look for each version. You can do so using AssemblyResolve:
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name == "LiteDB, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null")
{
return Assembly.LoadFrom(@"......packagesLiteDB.1.1.1libnetLiteDB.dll");
}
// The most recent version will be copied to the output directory.
// Use the normal resolution mechanism to locate it.
return null;
}
I am frequently switching between two versions for performing DB operation , so can loading both LiteDB version in their respective projects V_1_OperationProject and V_4_OperationProject affect on each other? E.g. 1. In V_1_OperationProject LiteDb v1 is loaded 2. Do some DB operation in V_1_OperationProject 3. Swich to V_4_OperationProject project and load LiteDB v4 4. Do some DB operation in V_4_OperationProject 5. Come back to V_1_OperationProject project and do some operation
– Smiley
Nov 27 '18 at 11:34
add a comment |
You need to tell the runtime where to look for each version. You can do so using AssemblyResolve:
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name == "LiteDB, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null")
{
return Assembly.LoadFrom(@"......packagesLiteDB.1.1.1libnetLiteDB.dll");
}
// The most recent version will be copied to the output directory.
// Use the normal resolution mechanism to locate it.
return null;
}
You need to tell the runtime where to look for each version. You can do so using AssemblyResolve:
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name == "LiteDB, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null")
{
return Assembly.LoadFrom(@"......packagesLiteDB.1.1.1libnetLiteDB.dll");
}
// The most recent version will be copied to the output directory.
// Use the normal resolution mechanism to locate it.
return null;
}
answered Nov 23 '18 at 13:25
Sergey SlepovSergey Slepov
738315
738315
I am frequently switching between two versions for performing DB operation , so can loading both LiteDB version in their respective projects V_1_OperationProject and V_4_OperationProject affect on each other? E.g. 1. In V_1_OperationProject LiteDb v1 is loaded 2. Do some DB operation in V_1_OperationProject 3. Swich to V_4_OperationProject project and load LiteDB v4 4. Do some DB operation in V_4_OperationProject 5. Come back to V_1_OperationProject project and do some operation
– Smiley
Nov 27 '18 at 11:34
add a comment |
I am frequently switching between two versions for performing DB operation , so can loading both LiteDB version in their respective projects V_1_OperationProject and V_4_OperationProject affect on each other? E.g. 1. In V_1_OperationProject LiteDb v1 is loaded 2. Do some DB operation in V_1_OperationProject 3. Swich to V_4_OperationProject project and load LiteDB v4 4. Do some DB operation in V_4_OperationProject 5. Come back to V_1_OperationProject project and do some operation
– Smiley
Nov 27 '18 at 11:34
I am frequently switching between two versions for performing DB operation , so can loading both LiteDB version in their respective projects V_1_OperationProject and V_4_OperationProject affect on each other? E.g. 1. In V_1_OperationProject LiteDb v1 is loaded 2. Do some DB operation in V_1_OperationProject 3. Swich to V_4_OperationProject project and load LiteDB v4 4. Do some DB operation in V_4_OperationProject 5. Come back to V_1_OperationProject project and do some operation
– Smiley
Nov 27 '18 at 11:34
I am frequently switching between two versions for performing DB operation , so can loading both LiteDB version in their respective projects V_1_OperationProject and V_4_OperationProject affect on each other? E.g. 1. In V_1_OperationProject LiteDb v1 is loaded 2. Do some DB operation in V_1_OperationProject 3. Swich to V_4_OperationProject project and load LiteDB v4 4. Do some DB operation in V_4_OperationProject 5. Come back to V_1_OperationProject project and do some operation
– Smiley
Nov 27 '18 at 11:34
add a comment |
The two LiteDB versions will have separate code and data. But there might be other ways for them to clash like sharing a common config, port numbers or whatever. I guess you will have to try and see if it works for you.
add a comment |
The two LiteDB versions will have separate code and data. But there might be other ways for them to clash like sharing a common config, port numbers or whatever. I guess you will have to try and see if it works for you.
add a comment |
The two LiteDB versions will have separate code and data. But there might be other ways for them to clash like sharing a common config, port numbers or whatever. I guess you will have to try and see if it works for you.
The two LiteDB versions will have separate code and data. But there might be other ways for them to clash like sharing a common config, port numbers or whatever. I guess you will have to try and see if it works for you.
answered Nov 27 '18 at 15:01
Sergey SlepovSergey Slepov
738315
738315
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53447256%2flitedb-how-to-add-2-dll-of-litedb-in-two-different-project-but-they-are-referen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I've done something similar in my project that referenced two different versions of the same DLL using <Aliases>. Have a look here: github.com/bzaar/DawgSharp/blob/master/…
– Sergey Slepov
Nov 23 '18 at 13:20