I have a visual studio solution where one of the projects has somehow acquired several .bin files. They are named bin00001.bin, bin00002.bin, etc... and contains some kind of registry information. The contents of these files are one section repeated a number of times.
bin00001.bin:
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'ApplicationName'
'ApplicationName.EXE'
{
val AppID = s '%APPID%'
}
}
}
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'ApplicationName'
'ApplicationName.EXE'
{
val AppID = s '%APPID%'
}
}
}
This file had two copies of this section and the other files has. Note that a similar file applicat.bin seems to be the original file with one such section and I guess that it needs to be there.
What are these and why are there so many of them and why are they spread over so many files?
they are referenced in the .rc file and are designated resource identifiers in resource.h. I'm also pretty sure it generated a few of them when I added a couple of ATL classes. (I should maybe mention that this is an MFC project!) I'll add the tag
Update
I should maybe add that the executable contains a COM type library. Would this have anything to do with COM registration?
I figured it out what they are.
Those .bin are replicas of the ApplicationName.rgs file.
I still don't know why Visual Studio created them in the first place though. Some kind of backup, I guess..?
Related
I’ve set up my own source control plug-in for Visual Studio.
It’s registered with visual studio and can be selected from the list of Source Control plug-ins.
I’ve got no issues with files that are modified from with in Visual Studio as I’m using to catch the event before save:
IVsRunningDocTableEvents3
If the file isn’t loaded as an active document in Visual Studio, I’m having problems detecting that it is about to be edited so I can check it out of Source Control.
I’ve tried using the ReSharper event – DocumentManagerOperations suggested here:
https://resharper-support.jetbrains.com/hc/en-us/community/posts/205991489-Document-Saved-Event
I’m having issues detecting if these types of files need checked out:
.DotSettings. – When saving the ReSharper options settings
csproj – When adding Nuget Packages with ReSharper.
.cs when editing files that are not opened in VS with ReSharper, i.e.
fix naming in project.
Is there an event that’s triggered when a file is edited but not loaded?
Thank you!
I used the interface:
IVsQueryEditQuerySave2
More information here:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivsqueryeditquerysave2?view=visualstudiosdk-2017
And made use of:
public int QueryEditFiles(uint rgfQueryEdit, int cFiles, string[] rgpszMkDocuments, uint[] rgrgf,
VSQEQS_FILE_ATTRIBUTE_DATA[] rgFileInfo, out uint pfEditVerdict, out uint prgfMoreInfo)
And:
public int QuerySaveFiles(uint rgfQuerySave, int cFiles, string[] rgpszMkDocuments, uint[] rgrgf,
VSQEQS_FILE_ATTRIBUTE_DATA[] rgFileInfo, out uint pdwQsResult)
something like this:
if (rgfQueryEdit != (uint)tagVSQueryEditFlags.QEF_ReportOnly)
{
if (rgpszMkDocuments != null)
{
foreach (var doc in rgpszMkDocuments)
{
//Do Something
Hope that helps you out.
I have 2 apps using the same images and resources except the AppIcon.
A common solution for this is having a seperate folder for each app under src and configuring gradle to use the corresponding folder.
In my case 99% of the resources are used from both apps, but only the appicon is different.
Do I have to still use the mechanism of having different res folders or is there also an easier way, so I do not have to clone all the resources ?
I thought I could do something like this:
I have a AndroidManifest Entry as follow :
<application android:name="bla.bla.MyApplication" android:largeHeap="true" android:icon="#drawable/icon" android:label="#string/app_name">
I can overwrite the name in gradle as follow, which works fine:
demo {
resValue "string", "app_name", "This is the Demo"
resValue "drawable", "icon", "demoicon"
}
Is there a way to overwrite the iconname in the same way ?
As you can see in the snippet above, I already tried, but I get an
Duplicate resources error, because my demoicon saved under res/drawable is generated automatically .
Isolved it the following way:
I did not want to clone the res folder for different build types, only to change the app-icon.
It can be done with manifestPlaceholders:
In my build.gradle :
buildTypes {
demo {
manifestPlaceholders = [iconpath:"#drawable/icon_timeline_test"]
}
it will replace the icon in the AndroidManifest, when referenced as follow:
android:icon="${iconpath}"
If your flavours name like production then:
android.sourceSets.production
{
res.srcDirs = ['res', '/path/to/production/res/dir']
}
And then in your /path/to/production/res/dir/drawable-* you would have your launcher icon.
I'm using VS2012 and T4 templates and assemblies are supposed to be shadow copied, meaning that you can reference an assembly in a template and then recompile that assembly. But this simply doesn't work for me. When I try it, when I try to rebuild the assembly, I get errors like:
Unable to copy file "obj\Debug\xxx.dll" to "..\bin\xxx.dll".
The process cannot access the file '..\bin\xxx.dll' because it is being used by another process.
The only way around it is to restart Visual Studio, and this is so tedious that I'm ready to abandon T4 entirely. What could I be doing wrong?
So this isn't really an answer yet but hopefully we get there
Test ran the following in VS2013 (I realize you run VS2012)
<## assembly name = "$(SolutionDir)\TestProj\bin\Debug\TestProj.dll"#>
<## import namespace = "TestProj"#>
namespace ConsoleApplication1
{
class <#=Testing.Name#>
{
}
}
The TestProj contains the Testing class
namespace TestProj
{
public static class Testing
{
public static string Name
{
get { return "Tester" ;}
}
}
}
This did work very well in VS2013 and as far as I remember this worked in VS2012 as well.I will try to install VS2012 on one of my machines but do you mind testing this simple sample on your installation to validate it's not something in your solution that holds the dll?
In case you are interested in the project file you can find it here:
https://github.com/mrange/CodeStack/tree/master/q21118821
I work around similar issue. T4 design time template is processed in different App domain under the same process of visual studio. When rebuild the solution Visual Studio tries to replace the referenced DLL, and it cannot replace it because it is still in use.
I work around this issue by deleting the AppDomain in which T4 template is processed. See msdn
I'm trying just to see resource names but nothing appears.
I've made and compiled a C++/CLI (Managed) DLL in Visual Studio 2010 and added some Resource files as a test (one icon and one bitmap). I've checked with PE Explorer and the resources definitely are there.
My simple code:
Assembly asm = Assembly.LoadFrom("C:\\test.dll");
String[] res = asm.GetManifestResourceNames();
I know that the DLL is loaded because when I debug i can see all the infos in the 'asm' variable. Also i can Import data (using MEF) from the DLL.
So, the DLL has the resources and the code IS loading the assembly for sure. But why my 'res' variable always returns empty string list?
EDIT:
I've created a C# Class Library (.dll) with a resource just for a test. Now it works!! But still in my C++/CLI DLL the resources do not appear. Somehow they are in the DLL but the code cant reach it (only in the C++ DLL). Maybe it would have something to do with managed/unmanaged code, but since i'm compiling it with CLR it does not seem to be the case. Any suggestions?
SOLUTION
I've got it! Just in case someone needs.
According to these topics:
Embedding resource in a C++/CLI project
and
http://bytes.com/topic/net/answers/571530-loading-markup-xamlreader-load-resource-file#post2240705
the problem is exactly the C++/CLI thing. You have to add it in Input item under Linker tab in Project Properties. Now it seems to work fine. Thanks
I have a similar problem and your question helps me to solve it.
my project platform is C++/CLI and my DLL platform is c#.
I want to pack DLL into my executive file, hence we should put DLL in the project resource file through below steps at first:
1.copy DLL in project path.
2.put DLL name(e.g. test.dll) in below place
properties->linker->input->Embeded Managed Resource File
then we should read and use embedded DLL:
Stream^ stream = Assembly::GetExecutingAssembly()->GetManifestResourceStream("test.dll");
array<unsigned char>^ dllRawBuffer = gcnew array<unsigned char>(stream->Length);
int res = stream->Read(dllRawBuffer, 0, stream->Length);
stream->Close();
Assembly^ dllAssembly = Assembly::Load(dllRawBuffer);
System::Type^ testclass = dllAssembly->GetType("TestNamespace.TestClass");
MethodInfo^ TestMethod = testclass->GetMethod("TestMethodName");
// Create an instance.
Object^ Testobj = Activator::CreateInstance(testclass);
// Execute the method.
array<Object^>^ params = gcnew array<Object^>(2);
params[0] = 2;
params[1] = 3;
Object^ result = TestMethod->Invoke(Testobj, params);
obviously, this solution only works for managed DLLs.
I have few frequently changeable fields stored in Resources.resx which auto generates the file Resources.designer.cs. It has email addresses, location paths which are to be updated based on needs
Now I would like to make the application usable even for a non developer - Even a lay man must be able to edit the email address & Paths.
Had a thought that if someone edits the .resx file(which is easily editable even in notepad) can I write some .exe code to auto generate the corresponding designer.cs for it?
Thanks for understanding..
If visual studio can do it, you can do it. But I think letting a non-technical person edit an xml file is asking for trouble. What I would do is build a small editing tool which pulls out only those fields you want to change, displays them in a simple form for altering, then writes them back to to the resx before rebuilding the designer.
I have done something similar to this for editing an application.exe.config file so that configurations can be changed without danger of (even a technical person) killing the thing with a typo, which is all too easy.
You could use something like
private void ReadResxFile(string filename)
{
if (System.IO.File.Exists(filename))
{
using (ResXResourceReader reader = new ResXResourceReader(filename))
{
//TODO
}
}
}
public void SaveResxAs(string fileName, string key, string value)
{
try
{
using (ResXResourceWriter writer = new ResXResourceWriter(fileName))
{
writer.AddResource(key, value);
writer.Generate();
}
}
catch (Exception error)
{
throw error;
}
}