Ghost modules in modules.xml - intellij-idea

Here is my modules.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/../...iml" filepath="$PROJECT_DIR$/../...iml" />
<module fileurl="file://$PROJECT_DIR$/7Wonders.iml" filepath="$PROJECT_DIR$/7Wonders.iml" />
<module fileurl="file://$PROJECT_DIR$/../AFLib/AFLib.iml" filepath="$PROJECT_DIR$/../AFLib/AFLib.iml" />
<module fileurl="file://$USER_HOME$/Documents.iml" filepath="$USER_HOME$/Documents.iml" />
<module fileurl="file://$USER_HOME$/Documents.iml" filepath="$USER_HOME$/Documents.iml" />
<module fileurl="file://$USER_HOME$/Documents.iml" filepath="$USER_HOME$/Documents.iml" />
<module fileurl="file://$PROJECT_DIR$/../MultiConnect/MultiConnect.iml" filepath="$PROJECT_DIR$/../MultiConnect/MultiConnect.iml" />
<module fileurl="file://$PROJECT_DIR$/../MultiConnect/lib/MultiConnect-lib.iml" filepath="$PROJECT_DIR$/../MultiConnect/lib/MultiConnect-lib.iml" />
<module fileurl="file://$PROJECT_DIR$/_7Wonders/_7Wonders.iml" filepath="$PROJECT_DIR$/_7Wonders/_7Wonders.iml" />
<module fileurl="file://$PROJECT_DIR$/../AFLib/lib/lib.iml" filepath="$PROJECT_DIR$/../AFLib/lib/lib.iml" />
</modules>
</component>
</project>
"7 Wonders" is the app, "MultiConnect" and "AFLib" are my libraries.
The stuff starting with $USER_HOME is completely unneeded: there is no Documents.iml file. I delete these lines, Android Studio adds them back. Then it complains that it can't open a module... 2 modules... 3 modules... and so on, until I delete those lines manually again. If I click on "Details" in the error message, it offers to remove those modules from the project, but that doesn't seem to have any effect. I even tried to make the modules.xml file read-only, but Android Studio complains and refuses to work.
This issue does not affect usability, but seeing that "Error Loading Project" every single time is rather annoying.
I don't need the ...iml file (the 1st line) either, but at least the Studio doesn't complain about it, and doesn't add several copies of it.
Can anyone explain what's going on?

There could be many reasons why this is happening.
1. Uninstall plugin "Markdown support" from plugins in settings.
Try compiling the whole project before gradle refresh is done. And set gradle settings as "Offline Work".
This will save a lot of time and will also save on re-installation of gradle dependencies. This re-install probably will cause refresh in modules.xml

Related

How can I call nuget restore recursively when using packages.config?

I have a non-.NET-based project that I'm trying to hammer nuget into for managing the dependencies. Because of that, I have to use packages.config to define the dependencies for a project.
Right now, I've got it packing and pushing exactly as I want it, but when I restore the packages, it only restores the dependencies in the packages.config I list, none of the dependencies of that package. So, for instance, if I have an application, MyApp, with a dependency on Foo, which then has a dependency on Bar, calling nuget restore on MyApp will not put Bar into the packages folder.
According to the CLI documentation, the -Recursive flag does not work for projects using packages.config - which is a problem for me, as I need to use packages.config, as far as I can tell. Or at least, I don't really want to spend another 3 hours converting all 12 of my packages to use a different format if I can help it.
For reference, here's an example of what my files look like, currently:
MyApp's package.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Foo" version="1.0.0.0" allowedVersions="[1.0]" />
</packages>
Foo.nuspec
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- Required elements-->
<id>Foo</id>
<version>1.0</version>
<description>Foo</description>
<authors>Tesset</authors>
<dependencies>
<dependency id="Bar" version="[1.0]" />
</dependencies>
</metadata>
<files>
<file src=".\lib\Foo\**" target="lib\Foo" />
</files>
</package>
Bar.nuspec
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- Required elements-->
<id>Bar</id>
<version>1.0</version>
<description>Bar</description>
<authors>Tesset</authors>
</metadata>
<files>
<file src=".\lib\Bar\**" target="lib\Bar" />
</files>
</package>
And, for completeness, I'm calling nuget restore like:
nuget restore ".\MyApp\packages.config" -PackageSaveMode nuspec -OutputDirectory ".\MyApp\packages" -recursive
(Having or not having the -recursive flag makes no difference to whether Bar ends up in the packages folder)
So, is there a way in nuget to make sure Bar gets restored while leaving MyApp (and Foo) using a packages.config file? If not, then is there a way to restore the dependencies listed in the nuspec file, so I can do that recursion manually on the files nuget restore puts into .\MyApp\packages?

Intellij: Get rid of iml file

A colleague has downloaded my project which I've composed using IntelliJ-2019.2
On my machine, there is no .iml file (not in project root, nor in .idea folder).
He opened it using IntelliJ-2018.1 and a .iml file was created in project root.
We thought we could: Close IntelliJ-2018, uninstall, install 2019.2, delete the .iml and reopen the project with 2019.2.
However, that .iml file was created again...
Since he will be pushing to a repo, and in general because we want the whole team to work in the same way, I would like to remove this .iml, so that his project is handled by the IDE in the same way as the rest of the team.
How to "migrate" from .iml to whatever project configuration (module description) I am using (which has no .iml)?
if you use git, just add *.iml to the .gitignore file in the root of the project.
checkout https://www.gitignore.io/ to create a .gitignore for you project
in your case you need at least: https://www.gitignore.io/api/intellij
.iml file is a module file and generated by Intellij idea IDE that is used for keeping module configuration.
More info : https://www.jetbrains.com/help/idea/creating-and-managing-modules.html
For most of the people not familiar with module configuration, we don't have to worry about this file. Since it is auto generated file and used by Intellij Idea IDE, it is not needed for other team members.
To get rid of my-project.iml file I have tried 2 ways and both works :
Method 1:
add the .iml file to .gitignore file of you project.
Method 2:
Move it to any other directory on you system.
Move the file to any other directory (I moved it inside .idea directory of project as it waas added to gitignore)
Open module.xml file present in you .idea folder of project
Modify this part and update new path for the .iml file
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/my-project.iml" filepath="$PROJECT_DIR$/.idea/my-project.iml" />
</modules>
</component>
In the case of a vite project that stopped loading when i deleted the .iml file, i noticed (thanks to the second answer) that you can simply replace:
<module fileurl="..../some.iml"></module>
with the contents of some.iml:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<!-- previous contents: -->
<!--<module fileurl=""></module>-->
<!-- replacement contents: -->
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
</modules>
</component>
</project>
and the project works after using the repair ide function to reopen the project.

IntelliJ IDEA load module error

I am in IntelliJ IDEA 2017.1.2. I recently renamed a module from mod_plus to exp-packs and now I keep getting the error:
Error Loading Project: Cannot load module mod_plus
The old module does not exist. Under File-> Project Structure->Modules->Dependencies it does not show up, it was there, but I removed it when I first saw the error. It does not show up in the .iml file:
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Pyhton-Snippets" />
<orderEntry type="module" module-name="exp_packs" />
</component>
</module>
In the event log, when I click 'Details' and it asks do I want to remove, I click YES and it is gone for that session, but on restart it comes back. Any thoughts on how to get rid of it?
IntelliJ IDEA loads modules according to .idea/modules.xml file which contains the relative paths to the .iml files.
If you rename a module in IntelliJ IDEA using refactoring, modules.xml file is updated automatically. In other cases you may need to update the path manually.

Why am I getting, "Error 392 Error occurred in deployment step 'Activate Features': Operation is not valid due to the current state of the object."

Does a missing "Module" section in the Elements.xml file cause "Error 392 Error occurred in deployment step 'Activate Features': Operation is not valid due to the current state of the object."?
All of a sudden, I get that error when trying to rebuild a Sharepoint Web Part. One thing I researched indicates that perhaps Elements.xml has a problem. I haven't changed anythying in this in a long while, nor have I changed anything explicitly, I don't think, but here it is as it now stands:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Receivers ListTemplateId="104">
<Receiver>
<Name>PostTravelItemEventReceiverItemAdded</Name>
<Type>ItemAdded</Type>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<Class>PostTravelWizard.PostTravelItemEventReceiver.PostTravelItemEventReceiver</Class>
<SequenceNumber>10000</SequenceNumber>
</Receiver>
<Receiver>
<Name>PostTravelItemEventReceiverContextEvent</Name>
<Type>ContextEvent</Type>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<Class>PostTravelWizard.PostTravelItemEventReceiver.PostTravelItemEventReceiver</Class>
<SequenceNumber>10000</SequenceNumber>
</Receiver>
</Receivers>
</Elements>
So all it has right now is a reference to the two "Event Receiver" handlers I added; I compared this non-working project's Elements.xml file with other Elements.xml files I have (from Web Parts that do work); one of them looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
<Module Name="TravelFormHelpWebPart" List="113" Url="_catalogs/wp">
<File Path="TravelFormHelpWebPart\TravelFormHelpWebPart.webpart" Url="TravelFormHelpWebPart.webpart" Type="GhostableInLibrary" >
<Property Name="Group" Value="Financial Affairs Forms" />
</File>
</Module>
</Elements>
...and the other one is very similar, like so:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
<Module Name="DPSVisualWebPart" List="113" Url="_catalogs/wp">
<File Path="DPSVisualWebPart\DPSVisualWebPart.webpart" Url="DPSVisualWebPart.webpart" Type="GhostableInLibrary" >
<Property Name="Group" Value="Financial Affairs Forms" />
</File>
</Module>
</Elements>
The difference seems to be that the working Web Apps have a "Module" section in their Elements.xml file
There was one other clue, too, from the link above, to wit:
If step 2 didn't resolve your error, check if your deployment target is set to "WebApplication". It needs to be set to "Global AssemblyCache" instead.
...and here, too, somehow, this non-working WebPart was set to "WebApplication," whereas the others are set to "GAC"). Changing that didn't help, though - I still get the same err msg as reported above.
So if the missing "Module" section is the problem, that was apparently there earlier (when it was working) and somehow got 86'd (along with the changing of the project's "Assembly Deployment Target" property, apparently). Why would/how could that happen?
Adding (back, apparently) the Module section did the trick.
Specifically, I added the following above the "Receivers" section:
<Module Name="PostTravelWizardWebPart" List="113" Url="_catalogs/wp">
<File Path="PostTravelWizardWebPart\PostTravelWizardWebPart.webpart" Url="PostTravelWizardWebPart.webpart" Type="GhostableInLibrary" >
<Property Name="Group" Value="Financial Affairs Forms" />
</File>
</Module>
...and it now deploys successfully.
(Note that I also changed (again, back, apparently) the value of the project's "Assembly Deployment Target" property to "GlobalAssemblyCache" from "WebApplication"

Windows 8 App Manifest: Image Assets Error

These images default VS images.But it doesn't work.
Error 4 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\StoreLogo.scale-100.png' does not exist.
Error 3 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\SplashScreen.scale-100.png' does not exist.
Error 2 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\SmallLogo.targetsize-32.png' does not exist.
Error 1 Payload file
'C:\Users\Mert\documents\visual studio 2012\Projects\Y\P\Assets\SmallLogo.scale-100.png' does not exist.
I know question is incomprehensible but I don't find different way to explain.
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="" Publisher="CN=Mert" Version="1.0.0.0" />
<Properties>
<DisplayName>Y</DisplayName>
<PublisherDisplayName>Mert</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Y.App">
<VisualElements DisplayName="Y" Logo="Assets\Logo.png" SmallLogo="Assets\SmallLogo.png" Description="Y" ForegroundText="light" BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>
I also had this problem last day. I noticed that when I deleted an image from assert, it wont delete its occurrence from the Solution explorer in Visual Studio. Delete those files from solution explorer fixed the issue.
Cheers...!
I just encountered this myself.
It seems Visual Studio can't handle a trial-and-error approach for logos.
I got rid of it by manually editing the .csproj file and removing the missing assets from there.
There is a workaround by setting the Generate App Bundle setting to Never.