"AfterTargets" error - building solution via command line

Class library usage, coding and language questions.
manalitatke
Posts: 36
Joined: Mon Jan 16, 2017 3:24 pm

"AfterTargets" error - building solution via command line

Post by manalitatke » Tue Dec 05, 2017 5:34 pm

Hello,

i am quite a newbie for MSBuild Project file implementation for a Ranorex solution.

While i was trying to refer the above post:
https://www.ranorex.com/forum/how-to-bu ... t1888.html


I am trying to create a csproj file for my ranorex solution which can be used for continuous integration using Visual Studio MSBuild project file.


I want to build my current solution on command line, before i try to use my Solution.exe in my csproj file.

After, copying all the required files ( .rxsln, .sln, ranorex.settings, sln folder, .csproj) in the v3.5 folder:

I used the following command for building my ranorex cs proj on command line:

%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe solution.csproj
While, i try to build the solution as mentioned in the above post, i get a 'AfterAll' targets in element <Target> is unrecognized error as shown in csproj target error.png



I also did the same procedure for building the ranorex solution via command line by using :

%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe solution.sln


I still get the same error as shown in sln target error.png


Do i need to modify the csproj file for incorporating the AfterBuild and BeforeBuild targets?

I basically want to incorporate the csproj file for building my solution and then executing the solution.exe for running my test suite.

Is this the correct way?


Since, i need to build the solution everytime before i run the Solution.exe, how can i build the solution using csproj file/command line for ranorex?


Thanks.
Attachments
sln target error.PNG
sln target error.PNG (21.23 KiB) Viewed 501 times
csproj target error.PNG
csproj target error.PNG (8.08 KiB) Viewed 501 times

User avatar
N612
Posts: 62
Joined: Mon Jul 11, 2016 4:01 pm

Re: "AfterTargets" error - building solution via command line

Post by N612 » Fri Dec 08, 2017 7:19 pm

I am trying to create a csproj file for my ranorex solution which can be used for continuous integration using Visual Studio MSBuild project file.
Why are you building your own .csproj? What does the auto-generated .csproj not do that you want it to? Wheather you created the solution in Ranorex Studio or Visual Studio, a .csproj will be generated which you can use with MSBuild. If you need customize the .csproj, build off this one instead of starting from scratch.
1.png
1.png (46.99 KiB) Viewed 442 times
Example

Code: Select all

msbuild "C:\Users\username\Documents\Programming Projects\RX Projects\SampleProject\SampleProject.sln"

...

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:03.73