CSharp demo

B

bob

I downloaded this CSharp demo here:

http://www.codeproject.com/KB/cs/usemsagentcsharp.aspx

Anybody know how to build it using just csc.exe at the command line?

I tried, and this is what happened:

csc Form1.cs
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

Form1.cs(16,11): error CS0246: The type or namespace name
'AxAgentObjects' could
not be found (are you missing a using directive or an assembly
reference?)
Form1.cs(17,11): error CS0246: The type or namespace name
'AgentObjects' could
not be found (are you missing a using directive or an assembly
reference?)
 
S

sloan

When you have a csproj or sln file, you'll want to use MSBUILD to build it,
its much nicer to work with.



Create a .bat file in the same directory as your WindowsApplication1.sln
file.




WindowsApplication1.sln


Call the file

MSBUILD.bat

Here are the contents of that file:

=======Start bat file contents, do not include this line

@echo off
ECHO When/If prompted with the question:
ECHO .

ECHO Does ".........." specify a file name or directory name on the
target
ECHO (F = file, D = directory)?
ECHO _
ECHO You should answer with "D" for directory.

ECHO _
ECHO _
ECHO _

ECHO When/If prompted with the question:
ECHO _
ECHO Overwrite (...........)
ECHO (Yes/No/All)?
ECHO _
ECHO You should answer with "A" for "All"
ECHO _

@echo on


set msBuildDir=%WINDIR%\Microsoft.NET\Framework\v2.0.50727

call %msBuildDir%\msbuild WindowsApplication1.sln /p:Configuration=Release


XCOPY .\bin\Release\*.* c:\wutemp\ReleaseBuild_WindowsApplication1
/EXCLUDE:.\exclude.txt /e/s

=======END bat file contents, do not include this line


NOW CREATE A Text File...........call it "exclude.txt"...same directory

=======Start exclude txt file contents, do not include this line
..vbproj
..csproj
..scc
..resx
..vb
..cs
..snk
..pdb
..xsx
..xsd
..sln
..vssscc
..bat
exclude.txt

=======End exclude txt file contents, do not include this line



Double click the .bat file.......and it should build AND it should copy a
release version to
c:\wutemp\ReleaseBuild_WindowsApplication1

I would create the directory
c:\wutemp\
before you double click the .bat file.



But now you have a build, an easy way to reproduce it, and an "output"
directory with NO extra fluff files.
 
S

sloan

There is no msbuild for 1.1 framework.

So my advice was in vain.

Sorry.

I'm not a csc.exe guru, so I can't help there.
 
M

miher

I downloaded this CSharp demo here:

http://www.codeproject.com/KB/cs/usemsagentcsharp.aspx

Anybody know how to build it using just csc.exe at the command line?

I tried, and this is what happened:

csc Form1.cs
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

Form1.cs(16,11): error CS0246: The type or namespace name
'AxAgentObjects' could
not be found (are you missing a using directive or an assembly
reference?)
Form1.cs(17,11): error CS0246: The type or namespace name
'AgentObjects' could
not be found (are you missing a using directive or an assembly
reference?)

Hi,

It seems to me that You are missing some COM interop assemblies. You can try
to create those from command line if You insist (start with looking at
tlbimp.exe), but I think one make himself a HUGE favour by using VS to
create those. (If You dont have Visual Studio consider
http://www.microsoft.com/Express/ for a free one)

Hope You find this useful.
-Zsolt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top