Calling MSBuil with arguments in PowerShellScript
Hi,
I am trying to call below line of code from powershell script. But it is giving an error..Installer.target file exists in the same location (C:\Projects\Main\src>).
What is the wrong with below code? Could you please advise.
PS C:\Projects\Main\src> "C:\Program Files (x86)\MSB
uild\12.0\Bin\MSBuild.exe" installer.targets /target:Installer /p:Version=1.0.8.
0"
Unexpected token 'installer.targets' in expression or statement.
At line:1 char:72
+ "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" installer.targets <<<<
/target:Installer /p:Version=1.0.8.0"
+ CategoryInfo : ParserError: (installer.targets:String) [], Pare
ntContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
function Execute-Installar
Param ([string]$CustomBuildPath)
LogWrite "Creating msi : "
$msbuild ="${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild.exe"
$Args = " installer.targets" + " /target:Installer" + " /p:Version=1.0.8.0"
Write-Host $msbuild
Write-Host $Args
$build="""$msbuild""" + $Args
Write-Host $build
Invoke-Expression $build
Hi,
well, the first thing that is wrong is how you are trying to launch an application. Try this instead:
Start-Process $msbuild -ArgumentList @("installer.targets", "/target:Installer", "/p:Version=1.0.8.0")
Cheers,
Fred
There's no place like 127.0.0.1
Similar Messages
-
Call function with arguments in AS3
Hello!
I`m a new in Flex developing, and cannot understand same code
convention, im Java programmer.
How I can write correct function call in ActionScript, my
call: var goodsWnd:CreateGoodsWindow =
PopUpManager.createPopUp(this,
CreateGoodsWindow, true) as CreateGoodsWindow;
I wish call function above with argument, how I do that?
Where my class: public class CreateGoodsWindow extends
extends TitleWindow
public CreateGoodsWindow(data:Object)
}Use PopUpManager.addPopUp() instead of createPopUp().
addPopUp takes an object that has already been instantiated:
var createGoodsWindow:CreateGoodsWindow = new
CreateGoodsWindow(data);
PopUpManager.addPopUp(createGoodsWindow); -
(JavaScript, CS3) calling functions with arguments on click?
Hi all,
this is getting tricky:
I want to call a function when the user clicks on a button in my scripted application (a javascript window dialog).
Unfortunately, I need to pass several arguments to the function.
According to the scripting documentation, ".onClick" functions won't take arguments.
I would (somewhat reluctantly) work with (global) variables but the function itself is limited to variables within its own scope - blocking all variables set in main()
How should I approach this?
The basic idea is to have people set some settings in the UI and then do some things after they click ok.
The actual work is pretty complicated (replacing colors etc) and needs to be done to a lot of objects so it would make sense to do it in a function.
I'm pretty confused right now and don't know how to proceed.
Any hints are appreciated.
Many thanks,
MikeIt took some tinkering but I got it to work.
But I still don't see how I can access the whole DOM from within the onClick functions:
I can get to the dialog properties (this.parent.parent) but nevertheless don't have any way to access app.documents and such.
I was able to manage my way around by making the whole window a dialog instead of a window - thereby getting a return value from the OK button and being able to run the code from within main().
Still strange, though...
Cheers,
Mike -
About calling method with arguments
Hi,
I have a problem about calling method using reflection. my method is like follows:
public myMethod(Integer var1, MyObject mobj) {
I've tried to call the method using the following code,
Class[] parameterTypes = new Class[] {Integer.class, MyObject.class};
Object[] arguments = new Object[] {new Integer(2), mobj};
Method met=cl.getMethod("myMethod", parameterTypes);
But the in the last line NoSuchMethodException is thrown.
How can I send the reference of MyObject to myMethod()?
Thanx
ronyShould work ok:
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Test {
static class MyObject {}
public static void main(String[] args) throws Exception {
Class c = Test.class;
Class[] parameterTypes = new Class[] {Integer.class, MyObject.class};
try {
Object[] arguments = new Object[] {new Integer(2), new MyObject()};
Method met = c.getMethod("myMethod", parameterTypes);
met.invoke(new Test(), arguments);
} catch (NoSuchMethodException e) {
System.out.println(e);
} catch (IllegalAccessException e) {
System.out.println(e);
} catch (InvocationTargetException e) {
System.out.println(e);
public void myMethod(Integer var1, MyObject mobj) {
System.out.println("myMethod");
} -
Hi,
I have a Sharepoint 2013 farm I am trying to provision search for (not the same as my other thread). However, I get the below error:
Exception calling "Activate" with "0" argument(s): "Topology does not contain any components of type Microsoft.Office.Server.Search.Administration.Topology.AdminComponent"
In my script, I have the following:
New-SPEnterpriseSearchAdminComponent -SearchTopology $clone -SearchServiceInstance $SearchServiceInstanceServer3 -ErrorAction SilentlyContinue
So I am not sure why the error happens, when I am trying to set this component. However, it's not the first component to be set (index partition on non-local servers first). I can make it first, but why does this error happen?
UPDATE: I have noticed that the usage and health proxy on my farm is/was stopped, but I am not able to access the server(s) to look at this right now. Could this cause this issue?Do you already have Admin component running for the Search Service Application?
Usage and Health Service will not cause this issue.
Please also refer to below discussion to see if it helps:
http://social.technet.microsoft.com/Forums/sharepoint/en-US/02f0b072-aa3a-4b7f-9662-2caf373d1e57/setspenterprisesearchtopology-identity-newtopology?forum=sharepointgeneral
Warm Regards,
Bhavik K Jain
Sr. Software Engineer - SharePoint Administration
Please vote if my reply helps and ensure that you mark a question as Answered once you receive a satisfactory response. -
Hi i am trying to add a new item and update existing field value in a document library with powershell
but i receive below error message.
PS C:\Users\spfarm> C:\Scripts\add.ps1
Exception calling "Update" with "0" argument(s): "To add an item to a document
library, use SPFileCollection.Add()"
At C:\Scripts\add.ps1:24 char:16
+ $newItem.Update <<<< ()
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
#Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
#Variables that we are going to use for list editing
$webURL = "http://tspmcwfe:89"
$listName = "test"
#Get the SPWeb object and save it to a variable
$web = Get-SPWeb $webURL
#Get the SPList object to retrieve the "Demo List"
$list = $web.Lists[$listName]
#Create a new item
$newItem = $list.Items.Add()
#Add properties to this list item
$newItem["Title"] = "My second item!"
$newItem["Info"] = "s15"
#Update the object so it gets saved to the list
$newItem.Update()
$web.Dispose()
adilHi Adil,
Document Library is different from a normal list. The document library contains files inside it. You need to update the code to add a document to the library. Then you can get hold of the List Item represented by that file and update its properties. Here
is an example:
$WebURL = "http://aissp2013/sites/TestSite"
$DocLibName = "Docs"
$FilePath = "c:\blogs.txt"
# Get a variable that points to the folder
$Web = Get-SPWeb $WebURL
$List = $Web.GetFolder($DocLibName)
$Files = $List.Files
# Get just the name of the file from the whole path
$FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1)
# Load the file into a variable
$File= Get-ChildItem $FilePath
# Upload it to SharePoint
$spFile = $Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(),$false)
$item = $spFile.Item
$item["Title"] = "New Title"
$item.Update()
$web.Dispose()
Blog | SharePoint Learnings CodePlex Tools |
Export Version History To Excel |
Autocomplete Lookup Field -
Hi,
I am getting an error System.Management.Automation.MethodInvocationException: Exception calling "ExecuteQuery" with "0" argument(s): "$Resources:core,ImportErrorMessage;" ---> Microsoft.SharePoint.Client. ServerException:
$Resources:core,ImportErrorMessage;
Following is my powershell script on line
$context.ExecuteQuery(); it is throwing this error.
function AddWebPartToPage([string]$siteUrl,[string]$pageRelativeUrl,[string]$localWebpartPath,[string]$ZoneName,[int]$ZoneIndex)
try
#this reference is required here
$clientContext= [Microsoft.SharePoint.Client.ClientContext,Microsoft.SharePoint.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c]
$context=New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
write-host "Reading file " $pageRelativeUrl
$oFile = $context.Web.GetFileByServerRelativeUrl($pageRelativeUrl);
$limitedWebPartManager = $oFile.GetLimitedWebPartManager([Microsoft.Sharepoint.Client.WebParts.PersonalizationScope]::Shared);
write-host "getting xml reader from file"
$xtr = New-Object System.Xml.XmlTextReader($localWebpartPath)
[void] [Reflection.Assembly]::LoadWithPartialName("System.Text")
$sb = new-object System.Text.StringBuilder
while ($xtr.Read())
$tmpObj = $sb.AppendLine($xtr.ReadOuterXml());
$newXml = $sb.ToString()
if ($xtr -ne $null)
$xtr.Close()
#Add Web Part to catalogs folder
write-host "Adding Webpart....."
$oWebPartDefinition = $limitedWebPartManager.ImportWebPart($newXml);
$limitedWebPartManager.AddWebPart($oWebPartDefinition.WebPart, $ZoneName, $ZoneIndex);
$context.ExecuteQuery();
write-host "Adding Web Part Done"
catch
write-host "Error while 'AddWebPartToPage'" $_.exception| format-list * -force
ERROR:
Error while 'AddWebPartToPage' System.Management.Automation.MethodInvocationException: Exception calling "ExecuteQuery" with "0" argument(s): "$Resources:core,ImportErrorMessage;" ---> Microsoft.SharePoint.Client.
ServerException: $Resources:core,ImportErrorMessage;
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at ExecuteQuery(Object , Object[] )
at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)
--- End of inner exception stack trace ---
at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)
at System.Management.Automation.DotNetAdapter.MethodInvokeDotNet(String methodName, Object target, MethodInformation[] methodInformation, Object[] arguments)
at System.Management.Automation.Adapter.BaseMethodInvoke(PSMethod method, Object[] arguments)
at System.Management.Automation.ParserOps.CallMethod(Token token, Object target, String methodName, Object[] paramArray, Boolean callStatic, Object valueToSet)
at System.Management.Automation.MethodCallNode.InvokeMethod(Object target, Object[] arguments, Object value)
at System.Management.Automation.MethodCallNode.Execute(Array input, Pipe outputPipe, ExecutionContext context)
at System.Management.Automation.ParseTreeNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
Thanks Sethu for your comments. However i am running this powershell directly on server so believe
SharePointOnlineCredentials is not required.
I have tried it but still giving me same error -
Query AD cause Exception calling "FindAll" with "0" argument(s)
Hi all,
When I query an entry property of AD with PowerShell, i got some problems. Here is the script, what's wrong ? Any idea? Thanks!
Cause error at last line code. (Exception calling "FindAll" with "0" argument(s): "There is no such object on the server)
$MailboxServer = Get-MailboxServer -Identity $Env:COMPUTERNAME -ErrorAction SilentlyContinue
$dc = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$exchOAB = New-Object System.DirectoryServices.DirectoryEntry("LDAP://" + $dc.Name + "/cn=Offline Address Lists,cn=Address Lists Container, " + $MailboxServer.DistinguishedName)
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $exchOAB
$objSearcher.PageSize = 1000
$objSearcher.SearchScope = "OneLevel"
$objSearcher.Filter = "(objectClass=msExchOAB)"
$powershellOAB = $objSearcher.FindAll()This is one of, now, four duplicate posts.
¯\_(ツ)_/¯ -
Dynamic constructor call with arguments
hey all i am quite new to this dynamic creation stuff
basically i have an array of class literals i.e One.class Two.class Three.class
etc
i then loop through this array using the isInstance() method to find the objects correct type
when i find this type i want to then create an object of this type with arguments passed to the constructor
i know there is a way to create the object using a defualt non arg constructor call using newInstance()...
so to repeat is there a way to dynamically create an object while passing arguments to the constructor?
thanx robCall getContstructor() on the class passing it an array of argument types. Then call newInstance() on the Constructor object that gets returned passing it an array of the arguments.
-
How to run jar files with arguments?
Hi everybody,
Is it possible to run a jar file with arguments passed to its MAIN class?
If yes can you help me on how to do it?
ThanxI am in complete agreement with FahleE. I'll refine it a bit.
On my machine (running RedHatLinux8.0) you can run the demos like this.
1. open a console window
2. go to the directory where the demo you wish to run, say, demo.jar, is located
for instance for the SwingSet2-demo
cd /usr/lib/java/demo/jfc/SwingSet2
3. run the jar file
java -jar demo.jar
In order to run it windows style, ie, launching by double clicking, save these lines in a file called
LaunchJar.sh
cd /usr/lib/java/demo/jfc/SwingSet2
java -jar demo.jar
where demo.jar is the jar file you want to run.
Right click on the LaunchJar.sh and go to the 'Properties' tab. Check the 'Execute' permissions for Owner/groups/others. You can also do the same thing by chmod command.
Now double-click on the LaunchJar.sh file: your application should be launched.
Palash.
Please Note: It is important to set the path variable to your JAVA_HOME directory....
Otherwise, instead of
java -jar demo.jar, you will need to use the full path to your JAVA_HOME/bin directory like:
JAVA_HOME/bin /java -jar demo.jar.
Where JAVA_HOME is the directory where you have installed java. Typically it is usr/java or usr/local/java -
Setup JOB to run sh script with argument
Hi all,
Can anyone share your view and experience on How to setup Job to execute shell script with argument?
For example : I need to execute /export/home/joel/test.sh 20060921
20060921 is the argument.
If I define a program to execute the script, can I use DEFINE_PROGRAM_ARGUMENT to set the argument?
I am not sure because I have the understanding that it will only work with STORED_PROCEDURE program type.
How does Oracle Scheduler handle such case?
I really appreaciate your response.
ThanksHi,
The thread above contains information specific to shell scripts. For stored procedures you just set job_type to 'stored_procedure' , number_of_arguments to the number of arguments that you want to pass into the stored procedure and then call set_job_argument_value for each argument before finally enabling the job . So for example
begin
dbms_scheduler.create_job(
job_name=>'j1',
job_type=>'stored_procedure',
job_action=>'dbms_output.put_line',
number_of_arguments=>1);
dbms_scheduler.set_job_argument_value('j1', 1, 'this is my argument');
dbms_scheduler.enable('j1');
end;
Hope this helps,
Ravi. -
Listener calls Function plus Arguments??
Hi guys,
Not sure if there's an easy way to do this, I'd like a
listener to call a function with arguments when triggered.
Currently, what I have looks like this:
object.addEventListener(errorTrigger, functionToCall);
public function functionToCall():void {
...you get my idea...
And, I'd really like to add some arguments to the function. I
realize that if I use:
object.addEventListener(errorTrigger,
functionToCall(myArgument));
then it will want
functionToCall to
return a
function name to be used. Hopefully, you're still with me on
this...
The reason I want to add the arguments, is because I have
three different listeners.
And I'd rather not have three different functions to deal
with them, I'd rather consolidate it into one function and use the
argument to distinguish the difference.
Rather than:
object.listener(error1, function1);
object.listener(error2, function2);
object.listener(error3, function3);
function1 ():void {}
function1 ():void {}
function1 ():void {}
I'd prefer something like:
object.listener(error1, function(1));
object.listener(error2, function(2));
object.listener(error3, function(3));
function(num):void {}
Hopefully, that all makes sense. Sorry, I'd post the code,
but it's way to long, and I'd rather not confuse anyone with
something else contained within it.
More than happy to try and cut it down if someone needs to
see the code though.
Cheers
OzThanks for your efforts, I don't quite know whether it's what
I'm looking for though.
The events I am using are predefined by Flex's upload
function. So, this may help:
fileUpload.addEventListener(HTTPStatusEvent.HTTP_STATUS,
uploadError);
fileUpload.addEventListener(IOErrorEvent.IO_ERROR,
uploadError);
fileUpload.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
uploadError);
And I'd really like to add the parameters to the end, like
so:
fileUpload.addEventListener(HTTPStatusEvent.HTTP_STATUS,
uploadError(param));
fileUpload.addEventListener(IOErrorEvent.IO_ERROR,
uploadError(param));
fileUpload.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
uploadError(param));
Is this something that I have to cast to / extend apon the
existing events using your technique above? In essence, creating a
duplicate of this event?
Thanks
Oz. -
Whether dbms_job accept procedure with argument
I am a new Oracle User.
Following is the code i am trying to make run.
create or replace trigger pp
after insert
on pipe
for each row
v_job number;
p number;
begin
p:=:new.id;
dbms_job.submit(v_job, 'sample(p);', null);
end;
Here p is the inserted value in column id of table pipe
& sample is a procedure with argument of type number.
Is it possible to call a procedure by dbms_job with argument from new inserted value in the table by using a trigger.
Thanks in advance.Yes, like this:
http://asktom.oracle.com/pls/ask/f?p=4950:8:4349110936516212294::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:7267435205059 -
[AS] doScript with arguments
Hi,
I'm trying to execute a js script through applescript but can't get the syntax right.
I'd like to parse var myFolder to do script. Any hints?
Thanks
// execute js file
set myFile to choose file with prompt "Choose a script"
set myFolder to choose folder with prompt "Choose a folder"
display dialog "myFolder is " & myFolder
tell application "Finder"
set myFileExt to name extension of myFile
end tell
tell application "InDesignServer"
if myFileExt is "jsx" then
--call this method with argument myFolder?
do script myFile language javascript
else
--call this method with argument myFolder?
do script myFile language applescript language
end if
end tell
// js
// print arguments
i = 0;
while (i < withArguments.length) {
app.consoleout(withArguments[i]);
i++;Here below is example for doscript with arguments. Hope it will help you.
--DoScriptReturnValues.applescript
--An InDesign CS4 AppleScript
--Shows how to get values back from a script run using
--the do script command.
main()
on main()
mySetup()
mySnippet()
myTeardown()
end main
on mySetup()
end mySetup
on mySnippet()
tell application "Adobe InDesign CS4"
--<fragment>
set nameA to "ScriptArgumentA"
set nameB to "ScriptArgumentB"
set nAc to nameA & ": "
set nBc to nameB & ": "
--Create a string to be run as an AppleScript.
set p1 to "tell application \"Adobe InDesign CS4\"" & return
set p2 to "tell script args" & return
set p3 to "set value name \"ScriptArgumentA\" value "
set p4 to "\"This is the first AppleScript script argument value.\""
set p5 to "set value name \"ScriptArgumentB\" value "
set p6 to "\"This is the second AppleScript script argument value.\""
set p7 to "end tell" & return
set p8 to "end tell"
set myAppleScript to p1 & p2 & p3 & p4 & return & p5 & p6 & return & p7 & p8
--Run the AppleScript string.
do script myAppleScript language applescript language
--Retrieve the script argument values set by the script.
tell script args
set myScriptArgumentA to get value name nameA
set myScriptArgumentB to get value name nameB
end tell
--Display the script argument values in a dialog box.
display dialog nAc & myScriptArgumentA & return & nBc & myScriptArgumentB
--Create a string to be run as a JavaScript.
set p1 to "app.scriptArgs.setValue(\"ScriptArgumentA\", "
set p2 to "\"This is the first JavaScript script argument value.\");" & return
set p3 to "app.scriptArgs.setValue(\"ScriptArgumentB\", "
set p4 to "\"This is the second JavaScript script argument value.\");" & return
set myJavaScript to p1 & p2 & p3 & p4
--Run the JavaScript string.
do script myJavaScript language javascript
--Retrieve the script argument values set by the script.
tell script args
set myScriptArgumentA to get value name nameA
set myScriptArgumentB to get value name nameB
end tell
--Display the script argument values in a dialog box.
display dialog nAc & myScriptArgumentA & return & nBc & myScriptArgumentB
--</fragment>
end tell
end mySnippet
on myTeardown()
end myTeardown
Shonky -
Call tranasaction with skip first screen in ecc6
Hi,
We are doing upgrade from 4.7 to ecc 6. We are getting an error while running a report( The addition "AND SKIP FIRST SCREEN" can't be used with "CALL TRANSACTION .. USING". ) in ecc6. This is not showing error in 4.7. Call transaction with skip first screen is fine in 4.7. But it is throwing an error in ecc6.
Could anybody provide me the pointers to rectify this error.
Regards,
RameshHi
Did you pass all the mandatory field values to the calling transaction , Because when you use this addition you need to pass all the mandatory field values then only it works fine. Check out whether you are passing all the mandatory field values.
Regards
Pavan
Maybe you are looking for
-
Is it possible to view attachments in calendar?
Is it possible to view attachments on an iphone when using the calendar?
-
Error trying to reinstall OS X after wiping hard drive
Hello - I wiped my old Mac drive clean according to the instructions on Apple regarding erasing the disc. Now I'm trying to reinstall the OS X but the computer won't let me select the Macintosh HD drive to install it to. There is absolutely nothing
-
Mirror vide output different Resolution
I want to mirror the video to my TV, in order to use it as a media cener. I will buy a VGA splitter so the same output could be seen in the LCD and my HD TV. The problem is that my LCD Monitor (Acer X221W) Supports 1680x1050 and my TV supports a lowe
-
How do i set my hp310 to wirelessly print?
how do i set my hp310 to wirelessly print?
-
Error message KI203 when transferring non valuted stock cross company
Hi, The posting of the stock transfers plant to plant is prevented by the error message KI203: Company code & is not assigned to CO area &. The Error is in following case : 1. The transfer posting is carried out between plants of different comp