When I try to retrieve some data in my source org, the results shows me as succeeded but directory didn't created always. Inside "RetrieveUnpackaged" folder, it is normally create the folder with retrieved data.
This is my package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Account</members>
<members>Contact</members>
<members>Opportunity</members>
<members>Lead</members>
<name>CustomObject</name>
</types>
<version>52.0</version>
</Package>
And this is the result:
Related
I have created npm package which has js and css files just similar to bootstrap as folder structure. I want to ship same package for .Net mvc web applications so I created .nuspec file specifying files from build output and created Nuget package. Both the Nuget and NPM package working great.
Now I want to publish same package for dot net core project. When I install same Nuget package in dot net core web application it installed successfully but does not copied static files to project folders.
How to create/fix nugget package of static files for dot net core application. I don't want to create .net core project to ship static files. It would be great if I could add some configuration file like .nuspec for dot net core application as well.
I have searched but not able to get any help in regards, So any suggestion or reference would be appriciated.
myproject.nuspec
<?xml version="1.0"?>
<package >
<metadata>
<id>MyPackage</id>
<version>1.0.1</version>
<title>MyProject</title>
<authors>Me</authors>
<owners>Me</owners>
<projectUrl>some url...</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This is similar to bootstrap</description>
<copyright>Copyright 2020</copyright>
<tags></tags>
<dependencies>
<dependency id="jQuery" version="[3.0.0, 4.0.0)" />
</dependencies>
</metadata>
<files>
<file src="dist\css\**\*.*" target="content\Content\css" />
<file src="dist\fonts\**\*.*" target="content\Content\fonts" />
<file src="dist\js\mypackage.js" target="content\Scripts" />
<file src="dist\images\**\*.*" target="content\Content\Images" />
</files>
</package>
Update : I tried solution given below by #thatguy it does copied the files in appropriate folders. I can see those in Visual Studio. But that newly created files and folder has arrow symbol on it while other files does not. I tried including css in page code but it does not found the newly created files.
What this arrow means and why its not finding the files ?
Create Nuget package for dot net core project from static files
You should use <package_id>.props file.
1) create a folder in your MyPackage called build and then add a file called MyPackage.props file in it.
2) Then add these in it:
<Project>
<Target Name="CopyFilesToProject" BeforeTargets="Build">
<Message Text="Copy css files to project" />
<ItemGroup>
<SourceScripts Include="$(MSBuildThisFileDirectory)..\..\content\**\*.* "/> //file from the nuget package
</ItemGroup>
<Copy
SourceFiles="#(SourceScripts)"
DestinationFiles="#(SourceScripts -> '$(MSBuildProjectDirectory)\%(RecursiveDir)%(Filename)%(Extension)')"
/>
</Target>
</Project>
3) change to use this nusepc file:
<?xml version="1.0"?>
<package >
<metadata>
<id>MyPackage</id>
<version>1.0.1</version>
<title>MyProject</title>
<authors>Me</authors>
<owners>Me</owners>
<projectUrl>some url...</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This is similar to bootstrap</description>
<copyright>Copyright 2020</copyright>
<tags></tags>
<dependencies>
<dependency id="jQuery" version="[3.0.0, 4.0.0)" />
</dependencies>
</metadata>
<files>
<file src="dist\css\**\*.*" target="content\Content\css" />
<file src="dist\fonts\**\*.*" target="content\Content\fonts" />
<file src="dist\js\mypackage.js" target="content\Scripts" />
<file src="dist\images\**\*.*" target="content\Content\Images" />
<file src="build\MyPackage.props" target="build" />
</files>
</package>
4) repack your project MyPackage and then first uninstall the old nuget package MyPackage first in your main project.
Then, clean nuget caches first or delete all caches under C:\Users\xxx(current user)\.nuget\packages.
After that, install the new version MyPackage and then build your project first and you can see the files be copied under the main project.
In addition, there is a similar issue about your request and also this one.
==================================
Update 1
If you want these files only be copied on Net Core projects, you should abandon using content node in nupkg. It will automatically copy files into the NET Framework main project when you install the package.
Instead, you could put these files under a different folder called resource of the nupkg.
You could follow my steps:
1) change MyPackage.props file to:
<Project>
<Target Name="CopyFilesToProject" BeforeTargets="Build">
<Message Text="Copy css files to project" />
<ItemGroup>
<SourceScripts Include="$(MSBuildThisFileDirectory)..\..\resource\**\*.* "/> //file from the nuget package
</ItemGroup>
<Copy
SourceFiles="#(SourceScripts)"
DestinationFiles="#(SourceScripts -> '$(MSBuildProjectDirectory)\%(RecursiveDir)%(Filename)%(Extension)')"
/>
</Target>
</Project>
2) change xxx.nuspec file to:
<?xml version="1.0"?>
<package >
<metadata>
<id>MyPackage</id>
<version>1.0.1</version>
<title>MyProject</title>
<authors>Me</authors>
<owners>Me</owners>
<projectUrl>some url...</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This is similar to bootstrap</description>
<copyright>Copyright 2020</copyright>
<tags></tags>
<dependencies>
<dependency id="jQuery" version="[3.0.0, 4.0.0)" />
</dependencies>
</metadata>
<files>
<file src="dist\css\**\*.*" target="resource\Content\css" />
<file src="dist\fonts\**\*.*" target="resource\Content\fonts" />
<file src="dist\js\mypackage.js" target="resource\Scripts" />
<file src="dist\images\**\*.*" target="resource\Content\Images" />
<file src="build\MyPackage.props" target="build" />
</files>
</package>
3) then repack your project and install the new one, before it, you should clean nuget caches first.
I'm trying to use NLog in an F# console application, I've managed to get it working using a configuration section in App.config however I can't get it working using a stand-alone NLog.config file. My NLog.config file is in the app route, just under App.config and the contents are:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true">
<targets>
<target name="stdFile" xsi:type="File" fileName="c:/temp/compliant.log"/>
<target name="display" xsi:type="OutputDebugString"/>
</targets>
<rules>
<logger name="compliant.mail.*" minlevel="Debug" writeTo="stdFile,display" />
</rules>
</nlog>
What am I doing wrong?
Also, intellisense isn't working for the xml even though I have included the xsd. :(
In your project, in the Properties for NLog.config, do you have NLog.config marked as "Copy Always"?
i am absolute beginner to Struts2. I am tying to follow tutorials on struts web site. i followed this tutorial. i have some trouble with it. i created dynamic web project on eclipse. Then i followed the tutorial. However when i run the example i get the following error.
There is no Action mapped for namespace [/] and action name [hello] associated with context path [/Hello_World_Struts_2]. - [unknown location]
i have the following directory structure
And my struts.xml file is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="basicstruts2" extends="struts-default" namespace="/">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="org.apache.struts.helloworld.action.HelloWorldAction" method="execute">
<result name="SUCCESS">/HelloWorld.jsp</result>
</action>
</package>
</struts>
thanks for your responses.
The struts.xml configuration file needs to be on the classpath (as opposed to in WEB-INF).
The linked tutorial assumes a Maven build and states the struts.xml file should go in src/main/resources, which will be included in the classpath in Maven builds. Since you're ignoring that part, you'll likely want to put it in the root of your source directory.
You have to create a classes/ folder under WEB-INF/ and put in your struts.xml file!
Right click the project. Go to properties deployment build path and add all .jar files to /WEB-INF/lib. Then you shouldn't get this error.
struts.xml should be located under directory: src/struts.xml..
And WEB-INF/web.xml you we need to configure the struts based on filter..
I got the same error and got solution looking at tomcat log when restarting : doctype were missing in struts.xml
so I added
<xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
now it works !
I solved the issue by adding default-action-ref tag, for example,
<default-action-ref name="home" />
after package tag
in struts.xml
<package name="user" namespace="/" extends="struts-default">
<default-action-ref name="upload" />
I had the same issue and I was facing it because of not mentioning the namespace correctly in struts.xml.
I added the following snippet in the web.xml :
<welcome-file>login.jsp</welcome-file>
and also making the namespace as "/" default...
Hope it answers your query..
In my case I had to rename Struts.xml ---> struts.xml
I'm currently trying to work my through a SalesForce.com tutorial on "Deploying with the Force.com Migration Tool (ANT)".
I’m sure I’m missing something… possibly because my knowledge and experience with Ant has been very limited.
I created a new Java Project and copied the Sample directory from salesforce_ant_20.0.zip into it. I modified build.properties and ran build.xml in eclipse to test this. That all worked fine.
So, I created Sandbox1 in the src directory and copied package.xml from my SFDC project into it. I then copied build.properties and build.xml from sample into the src directory. Now, when I went to run build.xml, it complained about the deployRoot mypkg not existing. I changed the deployRoot to Sandbox1 and tried to test again. Below is the result:
Buildfile: D:\education\sfdc\Deploy\src\build.xml
test:
[sf:deploy] Request for a deploy submitted successfully.
[sf:deploy] Request Id for the current deploy task: 04sA0000002GwsGIAS
[sf:deploy] Waiting for server to finish processing the request…
[sf:deploy] Request Status: Completed
BUILD FAILED
D:\education\sfdc\Deploy\src\build.xml:14: FAILURES:
Error: package.xml(Account):An object ‘Account’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(AccountContactRole):An object ‘AccountContactRole’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Activity):An object ‘Activity’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Asset):An object ‘Asset’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Campaign):An object ‘Campaign’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(CampaignMember):An object ‘CampaignMember’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Case):An object ‘Case’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(CaseContactRole):An object ‘CaseContactRole’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Contact):An object ‘Contact’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(ContentVersion):An object ‘ContentVersion’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Contract):An object ‘Contract’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(ContractContactRole):An object ‘ContractContactRole’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Event):An object ‘Event’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Idea):An object ‘Idea’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Lead):An object ‘Lead’ of type CustomObject was named in package.xml, but was not found in zipped directory
Error: package.xml(Opportunity):An object ‘Opportunity’ of type CustomObject was named in package.xml, but was not found in zipped directory
I case it helps:
(1) /src/sandbox1 only contains the file package.xml from a different functional SalesForce project in Eclipse.
This file says:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexComponent</name>
</types>
<types>
<members>*</members>
<name>ApexPage</name>
</types>
<types>
<members>*</members>
<name>ApexTrigger</name>
</types>
<types>
<members>*</members>
<name>CustomApplication</name>
</types>
<types>
<members>*</members>
<name>CustomLabels</name>
</types>
<types>
<members>*</members>
<members>Account</members>
<members>AccountContactRole</members>
<members>Activity</members>
<members>Asset</members>
<members>Campaign</members>
<members>CampaignMember</members>
<members>Case</members>
<members>CaseContactRole</members>
<members>Contact</members>
<members>ContentVersion</members>
<members>Contract</members>
<members>ContractContactRole</members>
<members>Event</members>
<members>Idea</members>
<members>Lead</members>
<members>Opportunity</members>
<members>OpportunityContactRole</members>
<members>OpportunityLineItem</members>
<members>PartnerRole</members>
<members>Product2</members>
<members>Site</members>
<members>Solution</members>
<members>Task</members>
<members>User</members>
<members>UserLicense</members>
<name>CustomObject</name>
</types>
<types>
<members>*</members>
<name>CustomObjectTranslation</name>
</types>
<types>
<members>*</members>
<name>CustomPageWebLink</name>
</types>
<types>
<members>*</members>
<name>CustomSite</name>
</types>
<types>
<members>*</members>
<name>CustomTab</name>
</types>
<types>
<members>*</members>
<name>DataCategoryGroup</name>
</types>
<types>
<members>unfiled$public</members>
<members>unfiled$public/Large_Invoice_Template</members>
<members>unfiled$public/MarketingProductInquiryResponse</members>
<members>unfiled$public/SUPPORTSelfServiceNewCommentNotificationSAMPLE</members>
<members>unfiled$public/SUPPORTSelfServiceNewUserLoginInformationSAMPLE</members>
<members>unfiled$public/SUPPORTSelfServiceResetPasswordSAMPLE</members>
<members>unfiled$public/SalesNewCustomerEmail</members>
<members>unfiled$public/SupportCaseAssignmentNotification</members>
<members>unfiled$public/SupportCaseCreatedPhoneInquiries</members>
<members>unfiled$public/SupportCaseCreatedWebInquiries</members>
<members>unfiled$public/SupportCaseResponse</members>
<members>unfiled$public/SupportEscalatedCaseNotification</members>
<members>unfiled$public/SupportEscalatedCaseReassignment</members>
<members>unfiled$public/SupportSelfServiceNewLoginandPassword</members>
<members>unfiled$public/SupportSelfServiceResetPassword</members>
<name>EmailTemplate</name>
</types>
<types>
<members>*</members>
<name>HomePageComponent</name>
</types>
<types>
<members>*</members>
<name>HomePageLayout</name>
</types>
<types>
<members>*</members>
<name>Layout</name>
</types>
<types>
<members>*</members>
<name>Letterhead</name>
</types>
<types>
<members>*</members>
<name>Profile</name>
</types>
<types>
<members>ApexDevNet</members>
<name>RemoteSiteSetting</name>
</types>
<types>
<members>unfiled$public</members>
<name>Report</name>
</types>
<types>
<members>*</members>
<name>ReportType</name>
</types>
<types>
<members>*</members>
<name>Scontrol</name>
</types>
<types>
<members>*</members>
<name>StaticResource</name>
</types>
<types>
<members>*</members>
<name>Workflow</name>
</types>
<version>20.0</version>
</Package>
The build.xml from the Java/Ant-based Force.com Migration Tool says:
<property file="build.properties"/>
<property environment="env"/>
<!-- Test out deploy and retrieve verbs for package 'mypkg' -->
<target name="test">
<!-- Upload the contents of the "mypkg" package -->
<sf:deploy
username="${sf.username}"
password="${sf.password}"
serverurl="${sf.serverurl}"
deployRoot="mypkg"
/>
<mkdir dir="retrieveOutput"/>
<!-- Retrieve the contents into another directory -->
<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveOutput" packageNames="MyPkg"/>
</target>
<!-- Retrieve an unpackaged set of metadata from your org -->
<!-- The file unpackaged/package.xml lists what is to be retrieved -->
<target name="retrieveUnpackaged">
<mkdir dir="retrieveUnpackaged"/>
<!-- Retrieve the contents into another directory -->
<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveUnpackaged" unpackaged="unpackaged/package.xml"/>
</target>
<!-- Retrieve all the items of a particular metadata type -->
<target name="bulkRetrieve">
<sf:bulkRetrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" metadataType="${sf.metadataType}" retrieveTarget="retrieveUnpackaged"/>
</target>
<!-- Retrieve metadata for all the packages specified under packageNames -->
<target name="retrievePkg">
<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveOutput" packageNames="${sf.pkgName}"/>
</target>
<!-- Deploy the unpackaged set of metadata retrieved with retrieveUnpackaged -->
<target name="deployUnpackaged">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="retrieveUnpackaged"/>
</target>
<!-- Deploy a zip of metadata files to the org -->
<target name="deployZip">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" zipFile="${sf.zipFile}" pollWaitMillis="1000"/>
</target>
<!-- Shows deploying code & running tests for code in directory -->
<target name="deployCode">
<!-- Upload the contents of the "codepkg" directory, running the tests for just 1 class -->
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="codepkg">
<runTest>SampleDeployClass</runTest>
</sf:deploy>
</target>
<!-- Shows removing code; only succeeds if done after deployCode -->
<target name="undeployCode">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="removecodepkg"/>
</target>
<!-- Shows retrieving code; only succeeds if done after deployCode -->
<target name="retrieveCode">
<!-- Retrieve the contents listed in the file codepkg/package.xml into the codepkg directory -->
<sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="codepkg" unpackaged="codepkg/package.xml"/>
</target>
<!-- Shows deploying code, running all tests, and running tests (1 of which fails), and logging. -->
<target name="deployCodeFailingTest">
<!-- Upload the contents of the "codepkg" package, running all tests -->
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="codepkg" runAllTests="true" logType="Debugonly"/>
</target>
<!-- Shows check only; never actually saves to the server -->
<target name="deployCodeCheckOnly">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="codepkg" checkOnly="true"/>
</target>
<!-- Retrieve the information of all items of a particular metadata type -->
<target name="listMetadata">
<sf:listMetadata username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" metadataType="${sf.metadataType}"/>
</target>
<!-- Retrieve the information on all supported metadata type -->
<target name="describeMetadata">
<sf:describeMetadata username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}"/>
</target>
Any idea what I did wrong or how to fix it?
The statement but was not found in zipped directory is an issue that has to do with the folder names you are using. If you are using custom folders instead of codepkg or mypkg etc, you need to change the names in retrieveTarget="codepkg" unpackaged="codepkg/package.xml" to reflect the new names in each of your targets. Check the image turned link for this explanation https://i.stack.imgur.com/GH40d.jpg[1]
The errors indicate that your package.xml is referencing components that don't have corresponding files in the directory structure. Either remove those references from package.xml or add the missing custom object files.
If that doesn't work, could you edit your question to include a directory listing for Sandbox1?
Your build file defaults to "deploy" from your machine to the server. This only works if you have content on your machine. Run a "retrieveUnpackaged" first. This will get everything on the server specified in the package.xml file. Then you can modify the results and deploy.
Personally, I only use the type of package.xml you show above for backup purposes. I keep one package.xml file will everything listed (using "*" plus standard objects) to retrieve the entire contents. I never use these results to make changes on the server because the eventual "deploy" will take forever.
Instead, create a package.xml file to get just the files you need to work on. Then make your code changes and then deploy with this smaller package.
Your package file is using an old version of the API:
<version>20.0</version>
And I'm pretty sure that version doesn't support everything you are doing in there.
quick edit: 36 is the current version I think.
edit2: Man this is an old question, how did I get here?
It is too late. But the issue here is very small I believe, Put allowMissingFiles="true" in the task. What this will do is if it wont find the files in the directory where your build.xml is poiniting it will still allow the deployment. Migration tool does not allow to mention the components in the package.xml if they are not in the directory and a workaround to that is using above option.
Even if you will have a package.xml to retrieve all the components from one org and you only have 2 classes to deply, the same package file will work with allowmissingfiles=true option.
I hope this will help someone looking for the solution to this issue. It is quite a basic issue, you need to have all your files in the same directory where your package.xml is. for example, if you are deploying your metadata from
deploy directory/folder
Than your package.xml and the other file should be part of this folder.
deploy folder will be having below structure
package.xml
objects
--> Product2.object
--> Account.object
--> Opportunity.object
--> ***
classes
other metadata
This issue comes when you are trying to deploy metadata without having these files as part of your root directory.
I need to create a WAR file that just contains static content files (gifs, jpgs, html, js, etc). I have a directory structure that contains all the files and need to create the WAR file via an ANT (1.5.1) build task. Right now I just have this in the ANT task:
<war destfile="${output.file}" webxml="WEB-INF/web.xml" basedir="${basedir}">
<fileset dir="${basedir}/sales" />
</war>
The files I want to include are in C:/basedir/sales and its subdirectories. When I try to run this task I get "A zip file cannot include itself". So clearly putting that fileset in there is not the right way to do it. I am unclear as to what I need to put in the task and in the web.xml file to specify what files to include within the archive.
I think the basedir="${basedir}" is causing you the problems. Also, I think the way you have it written will require that web.xml exist inside WEB-INF dir relative to where you run ant from.
So, try creating /WEB-INF/web.xml as follows:
<?xml version="1.0" encoding="utf-8" ?>
<web-app>
</web-app>
Then try updating /build.xml as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project name="yourproject" basedir="." default="war" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="war" description="--> build war file">
<war destfile="./mywar.war" webxml="WEB-INF/web.xml">
<fileset dir="C:/basedir/sales" />
</war>
</target>
</project>
Then you should be able to run "ant war" from command line and it should create "mywar.war" in your current directory.