ebceu4 / protobuf-csharp-port

Automatically exported from code.google.com/p/protobuf-csharp-port
0 stars 0 forks source link

Building the AddressBookProto.cs file in \Release\v4.0 does not work with AddressBook example project #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As requested in the stackoverflow question...

http://stackoverflow.com/questions/11966135/rebuilding-the-addressbook-example-i
n-protobuf-csharp-port-2-4-1-473?wwparam=1345067821

I am trying to regenerate AddressBookProtos.cs using the files from 
protobuf-csharp-port-2.4.1.473-release-binaries.

What steps will reproduce the problem?
1. ----------------------------------------------------------------

C:\Work\Protocol 
Buffers\protobuf-csharp-port-2.4.1.473-release-binaries\Release\v4.0>copy 
..\..\protos\tutorial\addressbook.proto .
        1 file(s) copied.

C:\Work\Protocol 
Buffers\protobuf-csharp-port-2.4.1.473-release-binaries\Release\v4.0>copy 
..\..\protos\google\protobuf\csharp_options.proto .
        1 file(s) copied.

C:\Work\Protocol 
Buffers\protobuf-csharp-port-2.4.1.473-release-binaries\Release\v4.0>copy 
..\..\protos\google\protobuf\descriptor.proto .
        1 file(s) copied.

C:\Work\Protocol 
Buffers\protobuf-csharp-port-2.4.1.473-release-binaries\Release\v4.0>copy 
..\..\protoc\protoc.exe .
        1 file(s) copied.

2. -----------------------------------------------------------------
In \v4.0, added the following lines to addressbook.proto below 'package 
tutorial':
import "csharp_options.proto";

option (google.protobuf.csharp_file_options).namespace = 
"Google.ProtocolBuffers.Examples.AddressBook";
option (google.protobuf.csharp_file_options).umbrella_classname = 
"AddressBookProtos"; 

3. -----------------------------------------------------------------
In \v4.0, changed the following line in csharp_options.proto from:
import "google/protobuf/descriptor.proto";
to
import "descriptor.proto";

4. -----------------------------------------------------------------
C:\Work\Protocol 
Buffers\protobuf-csharp-port-2.4.1.473-release-binaries\Release\v4.0>ProtoGen.ex
e .\addressbook.proto .\csharp_options.proto .\descriptor.proto
 --proto_path=.

5. -----------------------------------------------------------------
Copied the generated AddressBookProtos.cs to C:\Work\Protocol 
Buffers\protobuf-csharp-port-2.4.1.473-source\protobuf-csharp-port-2.4.1.473-sou
rce\src\AddressBook

6. -----------------------------------------------------------------
Built AddressBook.exe using the new AddressBookProtos.cs file.

What is the expected output? What do you see instead?
As per the stack overflow article.

What version of the product are you using? On what operating system?
protobuf-csharp-port-v2.4.1.473, Windows 7 Enterprise 64bit SP1, VS2010 
10.0.40219.1 SP1Rel and .Net 4.0.30319 SP1Rel

Please provide any additional information below.
If I run protogen.exe from C:\Work\Protocol 
Buffers\protobuf-csharp-port-2.4.1.473-release-binaries\Protoc and only do the 
following modifications to AddressBook.proto:

import "google/protobuf/csharp_options.proto";
option (google.protobuf.csharp_file_options).namespace = 
"Google.ProtocolBuffers.Examples.AddressBook";
option (google.protobuf.csharp_file_options).umbrella_classname = 
"AddressBookProtos";

Then the generated AddressBookProtos.cs file works. What is the 
purpose\difference between the files in \Release and \Protoc?

Original issue reported on code.google.com by pakw...@gmail.com on 16 Aug 2012 at 12:39

GoogleCodeExporter commented 9 years ago
Fixed 491:23d4f70c1b95

The imports and options you have named have been added to the original source 
proto so to prevent the need to customize the proto.  I've added the 
addressbook.proto to the build so you should no longer need to copy things 
around to get the proto to import.

I've also verified that I can manually rebuild Release/v4 binaries and build 
the proto with the following command-line:
{{
src\ProtoGen\bin\Release\ProtoGen.exe protos\tutorial\addressbook.proto 
--protoc_dir=.\lib --proto_path=protos/ -ignore_google_protobuf=true 
-output_directory=src\AddressBook
}}

This produces the correct output for AddressBookProtos.cs and the AddressBook 
example will compile, build, and run.

Original comment by Grig...@gmail.com on 10 Oct 2012 at 11:35